can anyone help me this script breaks at 17th line i don't know how i fix this script how i name this thing from player.Character.Name also i tried to fix this but it always break

local m = Instance.new("Message") 
m.Text = "" 
m.Parent = script
Clicky = script.Parent.ClickDetector
ClickDetecterNotActivated = true
Clicky.MouseClick:connect(function(player)
	if not ClickDetecterNotActivated then
		return
	end
	local Open = player.Character.Humanoid:LoadAnimation(script.Parent.Open)
	Open:Play()
	ClickDetecterNotActivated = false
	player.Character.Humanoid.WalkSpeed = 0
	player.Character.Humanoid.JumpPower = 0
	wait(0.5)
	script.Parent.Notify:Play()
	m.Text = player.Character.Name .. " Founded it!"
	local rewards = math.random(1,3)
	if rewards == 1 then
	player.leaderstats.Coin.Value = player.leaderstats.Coin.Value + 3000
	player.Character.Humanoid.WalkSpeed = 16
	player.Character.Humanoid.JumpPower = 50
	wait(3)
	script.Parent:Destroy()
end
if rewards == 2 then
	player.leaderstats.Coin.Value = player.leaderstats.Coin.Value + 5000
	player.Character.Humanoid.WalkSpeed = 16
	player.Character.Humanoid.JumpPower = 50
	wait(3)
	script.Parent:Destroy()
end
if rewards == 3 then
	player.leaderstats.Coin.Value = player.leaderstats.Coin.Value + 7500
	player.Character.Humanoid.WalkSpeed = 16
	player.Character.Humanoid.JumpPower = 50
    wait(3)
	script.Parent:Destroy()
end
end)

thank you!

4 comments

0

have u set a player variable?

0

oh i forgot about it

0

my bad.. i just have a missing parent LMAO!

0

lmao