OH AND how can i make a part that takes cash or someting
COMMUNITY QUESTION
how can i refrence a player s characther in a local script?
1 answer
Getting the Character:
local player = game.Players.LocalPlayer
local char = player.Character
--to get part of the character:
local part = char:WaitForChild("UpperTorso")
Reminder:
Lua is Case Sensitive
"WaitForChild" is important so there won't be any nil
Money Taking Script:
There are better tutorials online. This is the simple way.
local player = game.Players.LocalPlayer --getting the local player
local moneyVal = Instance.new("NumberValue", player) --making the number value to store
moneyVal.Name = "Cash" --name it to something so you can find it in the player tree
moneyVal.Value = 1000 -- starting value
while true do --loop to decrease it
wait(1)
moneyVal.Value -= 1 --this is main one; subtracts 1 from the value
end
Hope this Helps!
Ask me if you have any questions!
This discussion is preserved as it was. New answers, comments, and votes are closed.
