Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How i name something from parent in the script?

Asked by
kaemi 21
6 years ago
Edited 6 years ago

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!

0
have u set a player variable? caipira 29 — 6y
0
oh i forgot about it kaemi 21 — 6y
0
my bad.. i just have a missing parent LMAO! kaemi 21 — 6y
0
lmao caipira 29 — 6y

Answer this question