Script doesn't change name of the tool

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    So I am trying to achive that when the script detects that for example the cheese transparency = 0 then it changes the name of the tool to cheeseburger.

  2. What is the issue? Include screenshots / videos if possible!
    It doesn’t do that, and I get no errors or anything.
    Screenshot_44 Screenshot_45

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I have gone on ROBLOX’s script pages and found nothing.

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

local tool = script.Parent
local cheese = script.Parent.Cheese
if cheese.Transparency == 0 then 
	tool.Name = "CheeseBurger"
end
3 Likes

You putted script.tool just remove the script

I saw that, and I did that but it didn’t fix it.

Is the any errors in output?If yes please tell me

Nope. There is not a single error.

Try While true do
local tool = script.Parent
local cheese = script.Parent.Cheese
if cheese.Transparency == 0 then
tool.Name = “CheeseBurger”
end
wait()
end

That gives me output errors sadly.

What it says Try While wait() do

Screenshot_46

Did This errors again with While wait() do i cant solve The problem Its kinda weird for me.

Issue solved!
Take a look what fixed it.

local tool = script.Parent.Parent[“Raw Beef”]

local cheese = script.Parent.Cheese

while wait() do

if cheese.Transparency == 0 then

tool.Name = “CheeseBurger”

end

end

Good So the solution was While wait() do Good luck with your game

Yea, thank you! And also some parent mistakes.

Hook up a property signal changed event.

You can also use instance.Changed()

instance:GetPropertyChangedSignal(“ProperyName”):Connect(function()

Using a while loop is not a good idea.

Can you show me where to put that, since it kinda confuses me.

:GetPropertyChangedSignal() work just like .Changed event but instead of firing in every non-physics related property changes when used on a BasePart, it fires when the specified property parameter changes so it’s more efficient that a .Changed event. You can integrate it to your code like this:

local tool = script.Parent
local cheese = script.Parent.Cheese
cheese:GetPropertyChangedSignal(“Transparency”):Connect(function()
    if cheese.Transparency == 0 then 
	    tool.Name = "CheeseBurger"
    end
end)
2 Likes

Thank you! It is a better way. :smiley: