Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

why won't this script function on the change?

So this is suppose to function when the puck is covered and then the name changes. script:

while true do
	wait(0.1)
if game.Workspace.Puck.Name == 'glovedpuck'  then
	game.Workspace.glovedpuck.Anchored = true
	game.Workspace.GameSounds.Whistle:Play()
end
end

2 answers

✓ Accepted answer

This may work. I have tested it and it worked.

local Puck = workspace.Puck
local Whistle = workspace.GameSounds.Whistle

Puck.Changed:Connect(function(property)
	if property == Name and Puck.Name == "glovedpuck" then
		Puck.Anchored = true
		Whistle:Play()
	end
end)

-Arvid

1 comment

0

yo ty

You could use .Changed to detect the name change, for example:

script.Parent.Changed:Connect(function(ChangedProperty)
	if ChangedProperty = "Name" then -- Detect if the changed property is name
		if game.Workspace.Puck.Name == 'glovedpuck'  then
			script.Parent.Anchored = true	-- I would recommand u to put this script inside the part
			game.Workspace.GameSounds.Whistle:Play() 
		end
	end
end) -- Remember the ) !

2 comments

0

that dosen't seem to work either

0

Alright i changed a little bit, put this script in the Part (If there is any error in the output tell me)

This discussion is preserved as it was. New answers, comments, and votes are closed.