I’m trying to make a remote fire when a specific button is pressed, it works for the first button, but the rest of them it’s not working correctly all of a sudden.
local kc = script.Parent.kcButton
local sp = script.Parent.spButton
local theworld = script.Parent.ZaWarudoButton
local void = script.Parent.VoidButton
local standcheck = script.Parent.standCheck
local kcADD = game.ReplicatedStorage.addstandKC
local spADD = game.ReplicatedStorage.addstandSP
local twADD = game.ReplicatedStorage.addstandTW
local voidADD = game.ReplicatedStorage.addstandVOID
local humanoid = game:GetService("Players").LocalPlayer.Character:WaitForChild("Humanoid")
function kcClicked()
kcADD:FireServer()
humanoid.Health = 0
standcheck.Visible = true
script.Disabled = true
end
function spClicked()
spADD:FireServer()
humanoid.Health = 0
standcheck.Visible = true
script.Disabled = true
end
function TWClicked()
twADD:FireServer()
humanoid.Health = 0
script.Disabled = true
end
function VOIDClicked()
voidADD:FireServer()
humanoid.Health = 0
standcheck.Visible = true
script.Disabled = true
end
kc.MouseButton1Click:Connect(kcClicked)
sp.MouseButton1Click:Connect(spClicked)
theworld.MouseButton1Click:Connect(TWClicked)
void.MouseButton1Click:Connect(VOIDClicked)
The “kcClicked” works perfectly fine, but the rest of them don’t, and there is nothing in the output.
Here is what happens when the kc button is pressed: https://gyazo.com/8699be9806e9f3cc6dbf13653b913c57
The only things I see that might cause problems is
A. You disabling the script or
B. You’re not accounting for the screen UI’s “ResetOnSpawn” property and the variables you’re using are being set to nil (or something of the sorts), and thus the events aren’t firing.
Try using a bunch of prints to figure out where the issue is at, and if you can’t solve it then, come back with more information.
I believe it’s because you’re disabling the script, and it acts a global for all your functions. Have you tried not clicking kcClicked and trying the other buttons first?
The script is disabled when the button is pressed, however, it is enabled when the “remove stand” button is pressed, and it works just fine with the “KC” button. I did try to click SP button first but no signs of anything, not even in the output.
The code that enables them is in the ServerScriptService:
local kcAdd = game.ReplicatedStorage.addstandKC
kcAdd.OnServerEvent:Connect(function(Player)
game.StarterPack.StandStuff.kcHandler.Disabled = false
game.ServerScriptService.StandSpawning.kingCrimsonSpawn.Disabled = false
print("KC is now the players stand.")
end)
local SPAdd = game.ReplicatedStorage.addstandSP
SPAdd.OnServerEvent:Connect(function(Player)
game.StarterPack.StandStuff.spHandler.Disabled = false
game.ServerScriptService.StandSpawning.StarPlatinumSpawn.Disabled = false
print("Star platinum is now the active stand")
end)
Found the fix:
I’m surprised I didn’t catch this earlier, I gave the wrong names to certain buttons, I just renamed the buttons and it works just fine.