0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

robloxでassistant その205

Posted at

概要

robloxでassistant、やってみた。
練習問題やってみた。

練習問題

robloxでスクリプトのみで、RemoteEventを書け。

写真

image.png

サンプルコード

ReplicatedFirstに、localscriptを追加。

local workspace = game.Workspace
local part = Instance.new("Part", workspace)
part.Position = Vector3.new(0, 1, -9)
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Remote = ReplicatedStorage:WaitForChild("RemoteEvent")
local clickDetector = Instance.new("ClickDetector")
clickDetector.Parent = part  
clickDetector.MouseClick:Connect(function(player)
	print("clicked")
	if Remote then
		print("fire")
		Remote:FireServer()
	end
end)

ServerScriptServiceに、scriptを追加。



local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Remote = Instance.new("RemoteEvent", ReplicatedStorage)
Remote.OnServerEvent:Connect(function(player)
	print("fire server ok")
	print(player.Name)
	local fire = Instance.new("Fire")
	fire.Heat = 10
	fire.Color = Color3.new(1, 0, 0)
	fire.SecondaryColor = Color3.new(1, 1, 1)
	fire.Size = math.max(10, 10)
	fire.Parent = workspace
end)




以上

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?