-- This would be the localscript
local number = math.random(1,20)
local store = game:GetService("ReplicatedStorage")
local event = store:WaitForChild("RemoteEvent")
event:FireServer(number)
And for the server script:
local store = game:GetService("ReplicatedStorage")
local event = store:WaitForChild("RemoteEvent")
local function receiveEvent(number)
print(number)
end
event.OnServerEvent:Connect(receiveEvent)
Yea, refer to your own use-case now and it should be easy to see what you should do next, I’ll leave that part to you so you can clear your concepts! Goodluck! Ping if still stuck
-- Server script
local Part = script.Parent.Parent.Parent.Parent
local imageButton = script.Parent
local function playSound()
local Sound = Instance.new("Sound")
Sound.SoundId = "rbxassetid://3779053277"
Sound.Parent = Part
Sound.RollOffMaxDistance = 200
Sound.PlayOnRemove = true
wait()
Sound:Destroy()
end
local RemoteEvent = game.ReplicatedStorage:WaitForChild("CheckUserID")
RemoteEvent.OnServerEvent:Connect(function()
if imageButton.Parent.isTrue.Value == false then
workspace.ReactorStartup.ForceStartupFailure.Value = true
imageButton.Parent.isTrue.Value = true
imageButton.Parent.TextLabel.Text = "ENABLED"
playSound()
else
workspace.ReactorStartup.ForceStartupFailure.Value = false
imageButton.Parent.isTrue.Value = false
imageButton.Parent.TextLabel.Text = "DISABLED"
playSound()
end
end)
-- Local script
local players = game:GetService("Players")
local player = players.LocalPlayer
local userId = 457870639
local Part = workspace:WaitForChild("ServerSettingsScreen")
local SurfaceGui = Part:WaitForChild("SurfaceGui")
local StartupFailure = SurfaceGui:WaitForChild("StartupFailure")
local Button = StartupFailure:WaitForChild("Button")
local store = game:GetService("ReplicatedStorage")
local event = store:WaitForChild("CheckUserID")
Button.Activated:Connect(function()
if player.UserId == userId then
event:FireServer()
end
end)