#cash collect gone wrong
62 messages · Page 1 of 1 (latest)
when u hit something the hit returns like your left leg or your right leg or any other body part
the character is the model
so set character to hit.Parent.Parent
Thx
does it work now?
the money doesn't update
can u put an else print not a player
on the if Player check
i wanna see if it even finds a player
Mk
** You are now Level 1! **
It said leaderstats is not a valid member of players "players"
Bc I have a leaderstats script
so it can't find leaderstats as an instance inside the player
is there such instance?
Do you want me to show you picks of the scripts instead?
no i can read the script from the video
There's more
if leaderstats exists inside the player make that line local leaderstats = player:FindFirstChild("leaderstats") or player:WaitForChild("leaderstats")
the or WaitForChild is there so if the leaderstats haven't loaded yet for it to wait (by default 8 seconds) for them to load in
yea
It works
?
like most of the time (like 99%) with server scripts you should use FindFirstChild or WaitForChild and sometimes with local scripts
Ohhhh ok
just get the debris service and add it to it (look up on the roblox documentation on how)
it will automatically delete it after a set amount of time
lol no not that way
u can technically do it that way
but what ill do is
ill make a folder in workspace called debris
and ill make a server script that once detects a new item in there adds it to the debris
so it will auto get deleted
hm
** You are now Level 2! **
so u run less scripts at once for more performance
but the implementation is harder
ok
but yours works so
ima see how it goes
what about this lualocal Folder=workspace.Folder local function SpawnNewPart() while task.wait(2) do local NewPart=Instance.new('Part',Folder) NewPart.Size=Vector3.new(1,1,1) NewPart.Position=workspace.Part.Position NewPart.Touched:Connect(function(hit) if hit.Parent:FindFirstChild('Humanoid') then local Player=game.Players:GetPlayerFromCharacter(hit.Parent) Player.leaderstats.Cash.Value+=10 NewPart:Destroy() end end) end end SpawnNewPart()lol
creating a separate TASK just for an instance with a 3 second lifetime?
the debris system exists for a reason