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

Tool Not Naming?

Asked by 9 years ago

You May Recognize this script, I have made it too work for me but my problem is when it is supposed to rename the tool, the tool name comes out blank. Someone Help?

function tch(h)
if (h.Parent.Name == "Vanilla Sherbert") then
h.Parent.Name = "Mint Sherbert"
h.Parent.Handle.Type.TextureId = "http://www.roblox.com/asset/?id=141864017"
script.Parent.Parent.Spill.Transparency = 0
script.Parent.Sound:Play()
wait(2)
script.Parent.Parent.Spill.Transparency = 1
h.Parent.Drink1.BrickColor = BrickColor.new(21)
h.Parent.Drink1.Transparency = 0.1
d = Instance.new("Sound")
d.Parent = game.Workspace
d.Name = Drip
d.SoundId = "http://www.roblox.com/asset/?id=10722059"
d.Looped = false
d.IsPlaying = true
d.Volume = 0.5
wait(3)
d:remove()
end
end

script.Parent.Touched:connect(tch)

1 answer

Log in to vote
0
Answered by
xPolarium 1388 Moderation Voter
9 years ago

The reason to your problem is because you're not giving a string value to a String Property of a Sound Object. Which is located in line 13: d.Name = Drip. To fix this, you need set the value with two double quotation marks (" ").

Final Code:

function touch(h)
    if (h.Parent.Name == "Vanilla Sherbert") then
        h.Parent.Name = "Mint Sherbert"
        h.Parent.Handle.Type.TextureId = "http://www.roblox.com/asset/?id=141864017"
        script.Parent.Parent.Spill.Transparency = 0
        script.Parent.Sound:Play()
        wait(2)
        script.Parent.Parent.Spill.Transparency = 1
        h.Parent.Drink1.BrickColor = BrickColor.new(21)
        h.Parent.Drink1.Transparency = 0.1

        local d = Instance.new("Sound")
        d.Parent = game.Workspace
        d.Name = "Drip"
        d.SoundId = "http://www.roblox.com/asset/?id=10722059"
        d.Looped = false
        d.IsPlaying = true
        d.Volume = 0.5
        wait(3)
        d:remove()
    end
end

script.Parent.Touched:connect(touch)
0
Thank you that helped, but now in the output it says "cant set value" TayLife12 69 — 9y
0
Anything else after that? Set value on? xPolarium 1388 — 9y
Ad

Answer this question