Hey, for some reason, some of the scripts in my game only seem to be working in Studio. I enabled HTTP requests and API Services. I’m not too sure what to do.
Can… we uh… have the… script, please? We would have a bit of an issue in being able to help if we can’t see the script.
yes yes sorry, i’m new to this site i’ll get it for you right away
script.Parent.Touched:Connect(function(hit)
if hit.Parent:WaitForChild("Humanoid") then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player.Robbing.Value == true then
game.ReplicatedStorage.HideMoneyGui:FireClient(player)
player.leaderstats.Money.Value = player.leaderstats.Money.Value + player.CashCollected.Value
player.CashCollected.Value = 0
player.Robbing.Value = false
end
end
end)
I believe the issue is from this
Is there an error? Just making sure.
no errors, F9 log doesn’t seem to have any, either.
Try to check player
if player then
if player.Robbing.Value == true then
game.ReplicatedStorage.HideMoneyGui:FireClient(player)
player.leaderstats.Money.Value = player.leaderstats.Money.Value + player.CashCollected.Value
player.CashCollected.Value = 0
player.Robbing.Value = false
end
end
Second solve you need to commit script
And publish game
Have you tried publishing the game to roblox before testing it in a real server?
I have, I published it then went into the game. It doesn’t want to work there for some reason…
Alright, well, honestly it could be a lot of things that may be causing the problem. Like the touched event your connecting might be ignored because the part is destroyed, or not parented, or maybe it isn’t even connecting the event. Try using a print statement inside and just above the connection to see what your script is doing.
print(1)
script.Parent.Touched:Connect(function(hit)
print(2, hit)
if hit.Parent:WaitForChild("Humanoid") then
print(3, hit.Parent)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player.Robbing.Value == true then
print(4)
game.ReplicatedStorage.HideMoneyGui:FireClient(player)
player.leaderstats.Money.Value = player.leaderstats.Money.Value + player.CashCollected.Value
player.CashCollected.Value = 0
player.Robbing.Value = false
end
end
end)
Do you have team create enabled for the game in roblox studio?