so im making a game and when you hit an orb then you are suppose to get 10 coins but does anyone know why this script is not working?
You didn’t set the parent so that’s why It’s probably not working.
HMMMMMM
-
There’s no variables referencing
playerWhoTouched
-
You’re only creating 1
IntValue
, and not 1 for every player (Unless if you want there to only be 1) -
Not that huge a deal, but
connect
is deprecated -
There’s no cooldown/debounce assigned to the
onTouch
function
You can try this:
local DB = false
local Part = script.Parent
local Secs = Instance.new("IntValue")
Secs.Value = 10
Secs.Parent = workspace
local function onTouch(Part)
if not DB then
DB = true
Part.Transparency = 1
Part.CanCollide = false
wait(2)
DB = false
Part.Transparency = 0
Part.CanCollide = true
end
end
1 Like