I have a part to take the cheese from a player when they run through it but it does everything but add the cheese number and clear the backpack. No the output is no help it doesn’t say there is an error in the code or anything
Then maybe do more debugging- I can’t seem to figure out the issue.
script.Parent.Touched:Connect(function(hit)
local character = hit.Parent
if character:FindFirstChild("Humanoid") then
local plr = game.Players:GetPlayerFromCharacter(character)
if plr then
print(plr.Parent)
local CheeseCollected = game:GetService("ReplicatedStorage").RoundInfo.CheeseCollected
CheeseCollected.Value = CheeseCollected.Value + #plr.Backpack:GetChildren()
plr.Backpack:ClearAllChildren()
print("Cleared?")
end
end
end)
Btw, next time you make a devforum post; dont screenshot your code and post it; instead copy and paste it and format it with 3 backticks (i.e you insert 3 backticks, ``` and your line of code then end it with 3 backticks again)
Good luck rewriting the script; and make sure that you try to rewrite it completely in a different way than what you’ve done in the previous script. You could use Remote Events etc, but that’s up to you.