#cash collect gone wrong

62 messages · Page 1 of 1 (latest)

frosty reef
stuck fulcrum
#

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

frosty reef
#

Thx

stuck fulcrum
frosty reef
#

Nah still doesn't collect the cash

#

Well it dose

#

But dose not rise the amount

stuck fulcrum
#

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

frosty reef
#

Mk

wheat galeBOT
#

studio** You are now Level 1! **studio

frosty reef
#

It said leaderstats is not a valid member of players "players"

#

Bc I have a leaderstats script

stuck fulcrum
#

is there such instance?

frosty reef
#

Do you want me to show you picks of the scripts instead?

stuck fulcrum
#

no i can read the script from the video

frosty reef
#

There's more

stuck fulcrum
#

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

frosty reef
#

Ok

#

Brb

#

Line 22 right?

#

Thx

stuck fulcrum
#

yea

frosty reef
#

It works

stuck fulcrum
#

nice

#

glad i helped

#

Also

frosty reef
#

?

stuck fulcrum
#

like most of the time (like 99%) with server scripts you should use FindFirstChild or WaitForChild and sometimes with local scripts

frosty reef
#

Ohhhh ok

stuck fulcrum
#

just so yk

#

good luck with the game

frosty reef
#

Thx

#

wait I'm making a delete system how much time until the cash destroys

stuck fulcrum
#

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

frosty reef
#

i have the script

#

local cash = script.Parent
wait(3)
cash:Destroy()

stuck fulcrum
#

lol no not that way

frosty reef
#

i just need your opinin

#

it works tho

stuck fulcrum
#

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

frosty reef
#

hm

wheat galeBOT
#

studio** You are now Level 2! **studio

stuck fulcrum
#

so u run less scripts at once for more performance

#

but the implementation is harder

frosty reef
#

ok

stuck fulcrum
#

but yours works so

frosty reef
#

ima see how it goes

slender plover
# stuck fulcrum but yours works so

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

stuck fulcrum
#

the debris system exists for a reason