the normal script that sends a remoteevent
this script will not work if its a local script, but i want the remoteevent sent as local so the numbers that the player activates, only happens to THAT PLAYER
local ts = game:GetService("TweenService") local noise = workspace.dicenoise local p1 = script.Parent.Parent.rollmove.RI local p2 = script.Parent.Parent.rollmove.RII local box = script.Parent.Parent.rollmove.Box local click = script.Parent.ClickDetector local dicee = script.Parent.Parent.rollmove.dice:GetChildren() local dice = script.Parent.Parent.rollmove.dice local dicenum = #dicee for i = 1,dicenum do local diceget = dicee[i] diceget.Anchored = true end local default_dist = script.Parent.ClickDetector.MaxActivationDistance script.Parent.ClickDetector.MouseClick:Connect(function(player) game.ReplicatedStorage.Roll:FireAllClients() script.Parent.ClickDetector.MaxActivationDistance = 0 script.Parent.SurfaceGui.Rolling.Visible = true script.Parent.SurfaceGui.Roll.Visible = false wait() local function moveItem(item, wp) local ti = TweenInfo.new(2, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0) local tween = ts:Create(item, ti, { Position = wp.Position}) tween:Play() wait(2) end local function moveItems(item, wp) local ti = TweenInfo.new(0.1, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0) local tween = ts:Create(item, ti, { Position = wp.Position}) tween:Play() wait(0.1) end for i = 1,dicenum do local diceget = dicee[i] moveItems(diceget, p1) end moveItem(box, p1) for i = 1,dicenum do local diceget = dicee[i] diceget.Transparency = 1 moveItems(diceget, p2) end moveItem(box, p2) box.Orientation = Vector3.new(0,180,180) for i = 1,dicenum do local diceget = dicee[i] diceget.Transparency = 0 diceget.Anchored = false end noise.Playing = true wait(0.6) for i = 1,dicenum do local diceget = dicee[i] local display = diceget.numdisplay display.Enabled = true end wait(1.3) noise.Playing = true noise.TimePosition = 0 wait(5) for i = 1,dicenum do local diceget = dicee[i] local display = diceget.numdisplay diceget.Anchored = true diceget.Transparency = 1 moveItems(diceget, p1) display.Enabled = false end moveItem(box,p1) box.Orientation = Vector3.new(0,0,0) script.Parent.SurfaceGui.Rolling.Visible = false script.Parent.SurfaceGui.Roll.Visible = true script.Parent.ClickDetector.MaxActivationDistance = default_dist end)
this is the localscript that recieves the remoteevent, the script is in a folder with the number guis
local remote = game.ReplicatedStorage.Roll local ls = game.Players.LocalPlayer.leaderstats:WaitForChild("Rolls") game.ReplicatedStorage.Roll.OnClientEvent:Connect(function() for _, v in pairs(script.Parent:GetDescendants()) do if v:IsA("IntValue") then v.Value += 1 end end ls.Value = ls.Value + 1 end)
Hi, here you have used FireAllClient, meaning that all the clients in the game will be able to see what is happening, much like a serverscript. The only purpose I would see for a FireAllClients event is that to reach out every local player's player gui or whatever and inserting something in it using a localscript. However, that is definitely not what you are trying to acheive, so I recommend using the FireClient() event.
Here's the altered script with the FireClient event:
-- server script local ts = game:GetService("TweenService") local noise = workspace.dicenoise local p1 = script.Parent.Parent.rollmove.RI local p2 = script.Parent.Parent.rollmove.RII local box = script.Parent.Parent.rollmove.Box local click = script.Parent.ClickDetector local dicee = script.Parent.Parent.rollmove.dice:GetChildren() local dice = script.Parent.Parent.rollmove.dice local dicenum = #dicee
for i = 1,dicenum do
local diceget = dicee[i]
diceget.Anchored = true
end
local default_dist = script.Parent.ClickDetector.MaxActivationDistance
script.Parent.ClickDetector.MouseClick:Connect(function(add)
script.Parent.ClickDetector.MaxActivationDistance = 0
script.Parent.SurfaceGui.Rolling.Visible = true
script.Parent.SurfaceGui.Roll.Visible = false
game.ReplicatedStorage.Roll:FireClient(add)
wait()
local function moveItem(item, wp)
local ti = TweenInfo.new(2, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0)
local tween = ts:Create(item, ti, { Position = wp.Position})
tween:Play()
wait(2)
end
local function moveItems(item, wp)
local ti = TweenInfo.new(0.1, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0)
local tween = ts:Create(item, ti, { Position = wp.Position})
tween:Play()
wait(0.1)
end
for i = 1,dicenum do
local diceget = dicee[i]
moveItems(diceget, p1)
end
moveItem(box, p1)
for i = 1,dicenum do
local diceget = dicee[i]
diceget.Transparency = 1
moveItems(diceget, p2)
end
moveItem(box, p2)
box.Orientation = Vector3.new(0,180,180)
for i = 1,dicenum do
local diceget = dicee[i]
diceget.Transparency = 0
diceget.Anchored = false
end
noise.Playing = true
wait(0.6)
for i = 1,dicenum do
local diceget = dicee[i]
local display = diceget.numdisplay
display.Enabled = true
end
wait(1.3)
noise.Playing = true
noise.TimePosition = 0
wait(5)
for i = 1,dicenum do
local diceget = dicee[i]
local display = diceget.numdisplay
diceget.Anchored = true
diceget.Transparency = 1
moveItems(diceget, p1)
display.Enabled = false
end
moveItem(box,p1)
box.Orientation = Vector3.new(0,0,0)
script.Parent.SurfaceGui.Rolling.Visible = false
script.Parent.SurfaceGui.Roll.Visible = true
script.Parent.ClickDetector.MaxActivationDistance = default_dist
end)