I wanted to make something for my game, though i run in this problem. When i try to add a player’s variable or function (game.players.playeradded:connect(function(plr) the whole script that will come after that line of code will simply not execute. I could write this differently in a local script but i tried and it worked but it only executed on studio and not the actual game no matter how i wrote the script. Back to the main problem, it doesnt give any errors, it just simply doesnt execute the script that comes afterwards (note that i paused the script at a point so i could fix this problem)
Edit: I cancelled this ending so i dont technically need a fix now, though if you still want, you can still fix this and i may get back to working on it, thanks
local Button = script.Parent
local NukeAlarm = game.Workspace.NukeEnding["Nuke Alarm"]
local NukeArriving = game.Workspace.NukeEnding.NukeArrivingSong
local Ending = game.Workspace.NukeEnding.NukeEndingSong
local Explode = game.Workspace.NukeEnding.Rocket_Explode
local Event1 = game:GetService("ReplicatedStorage").NukeWarning
local Event2 = game:GetService("ReplicatedStorage").NukeEnding
local Event3 = game:GetService("ReplicatedStorage").NukePlayerStopMoving
Button.Activated:Connect(function()
game.Workspace["Grimace shake ending"].Interact.ProximityPrompt.Enabled = false
game.Workspace.CLASHROYALEOMGHEHEHE.ClickDetector.MaxActivationDistance = 0
game.Workspace["Grimace shake ending"].GrimaceShopBarrier.CanCollide = true
game.Workspace["Pineapple on pizza ending"].Pineapple.ProximityPrompt.Enabled = false --Dont consider me crazy, that ending is just a troll lol.
game.Workspace.NukeEnding.Barrier.CanCollide = true
game.Workspace.NukeEnding.Barrier.Transparency = 0
game.Workspace.NukeEnding.ClosedNukeSign.SurfaceGui.SIGN.Visible = true
game.Workspace["Grimace shake ending"].John:Destroy()
local anim = game.Workspace.CLASHROYALEOMGHEHEHE.Humanoid:LoadAnimation(game.Workspace.NukeEnding.Animation) --CLASHROYALEOMGHEHEHE isnt my player, its a model, just incase you though.
anim:Play()
anim.Looped = true
game.Workspace.Song.Playing = false
NukeAlarm.Playing = true
NukeAlarm.Looped = true
game.Lighting.NukeEndingColor.Enabled = true
Button.Parent = game:GetService("ServerStorage")
wait(5)
Event1:FireClient() --I need to add a variable that gets the player in the parentesis, if i do though the code afterwards will not execute
end)