概要
robloxでassistant、やってみた。
練習問題やってみた。
練習問題
robloxでスクリプトのみで、RemoteEventを書け。
写真
サンプルコード
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)
以上