Dear, Scripters/ Robloxians, I have a script that makes coins that players can pick up, but when a brick, or anything other than a player touches it, I get an error.
Workspace.Bloxites.Bloxites.Script:6: attempt to index local 'player' (a nil value) (Workspace>Bloxites>Bloxites>Script>Line 6)
thank you for considering this question.
local on = false local teleb = script.Parent function givepoint(touch) local parent = touch.Parent local player = game.Players:getPlayerFromCharacter(parent) local place = player.leaderstats.Bloxites if player ~=nil then if on == false then on = true teleb.Transparency = 1 teleb.CanCollide = false place.Value = place.Value + 1 wait(10) teleb.Transparency = 0 teleb.CanCollide = false on = false end end end teleb.Touched:connect(givepoint)