Hello there, I have both LocalScripts and a server script here where if the TextLabel changes to 0, the LocalScript fires a RemoteEvent called DisasterEvent of which will then result to a part changing it's transparency to 0 for every players, not just the player, however it does not seem to work after what I did, how do I fix this?
--LOCALSCRIPT local RS = game:GetService("ReplicatedStorage") local DisasterEvent = RS.DisasterEvent local TimerEvent = RS.TimerRemote local Timer = script.Parent local function trigger() DisasterEvent:FireServer() end if Timer.Text == "0" then trigger() DisasterEvent:FireServer() end
Here is the Server Script:
--SERVERSCRIPT local RS = game:GetService('ReplicatedStorage') local DisasterEvent = RS.DisasterEvent local part = game.Workspace.Grass DisasterEvent.OnServerEvent:Connect(function(pleaseworkalreadybroivehadenough) part.Transparency = 0 DisasterEvent:FireClient() end)
What you could do is;
--LOCALSCRIPT --Pretend you had the rest of your code up top and you made a variable pointing to your part instance named "DisasterPart". if Timer.Text == "0" then DisasterEvent:FireServer(DisasterPart) end
Then;
--SERVERSCRIPT DisasterEvent.OnServerEvent:Connect(function(Player, Part) Part.Transparency = 0 end) -- "Player" (the one who fired) is the first and default argument.
And here's a tip:
game.Workspace
, you can do workspace
instead, and it'll work! :3If this helped, please mark this as the answer which helped.