script.Parent.Event.OnServerEvent:Connect(function(Player)
local Mag = (script.Parent.Center.Position-Player.Character.HumanoidRootPart.Position).magnitude
pcall(function()
print(1)
if Mag <= script.Parent.Range.Value then
if script.Parent.Transparency == 0 then
print(2)
Player.leaderstats.Pumpkins.Value = Player.leaderstats.Pumpkins.Value + 1
local id = tonumber(Player.UserId)
game.ReplicatedStorage.nnn:FireClient(Player, "song", id, "LUX Events", "Congrats you found a pumpkin! Heres +1 Pumpkins collected", 5)
script.Parent.Transparency = 1
wait(100)
script.Parent.Transparency = 0
else
print(3)
local id = tonumber(Player.UserId)
game.ReplicatedStorage.nnn:FireClient(Player, "song", id, "LUX Events", "Someone already found this pumpkin, try again later", 5)
end
end
end)
end)
Can you show us how the event is fired? If none of your prints are showing up it makes me think that it’s just not getting fired at all. You could also try adding a print at the very top of the function just to be sure if it’s being fired or not.
Try removing the pcall to see if anything errors in there as pcall will silence that and make it hard to find an issue. Also make sure the event is fired and the script is not disabled.
Correct. Pcall returns a success Boolean and an error string. To me though I don’t see a reason why he uses pcall for this code though. Another note. returning in a pcall will result in that returned value to become the error string so long the pcall does not fail.
As for server side scripts everything should have loaded unless it’s added by other scripts. I just now realized the script seems to be in some kind of folder or something. So op should move the script into somewhere the script will run like ServerScriptService
Where is this script located? If you’re certain you’re firing the event properly from a local script then you most likely have the script somewhere it may not run like tobias mentioned.
I don’t personally see anything wrong with the setup that would break it but could you try adding a print at the top of the script if you have not? Also print what the pcall returns to see if it breaks at any moment