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

This Event happens for everyone and I want it to happen for one person?

So I have this radio to where when you click on it it destroys, but the problem is is that it destroys for everyone. Anybody have any idea on how to fix this



local model = game.workspace.Joe2 local plr = game.Players.LocalPlayer

game.Workspace.Radio.ClickDetector.MouseClick:Connect(function()

game.Workspace.Radio:Destroy()
for _,part in pairs(model:GetChildren()) do
	if part : IsA("BasePart") then
		part.Anchored = false
		wait(10)
		part.Anchored = true

	end

end

end)



3 comments

0

Make use of your plr variable?

0

do you have an example?

0

just use a localscript

1 answer

Answer is simple my friend. Just Insert a local script and rewrite the same script again but this time in the local script, and not regular script.

I Tested this script and it works:

local clickDetector = game.Workspace.Button.ClickDetector
local Part = game.Workspace.Part
function onMouseClick()
	print("Part1 Will Be Deleted In 3 Seconds")
	wait(3)
	Part:Destroy()
end

clickDetector.MouseClick:connect(onMouseClick)

If this answer has helped please up vote and click answered.

4 comments

0

Oh i always thought the same thing but the other way around, Sorry my mistake

0

But now the script doesent work

0

You have to put the Local Script in StarterPlayerScripts. I was just testing the local script and wasn't working until I placed it in StarterPlayerScripts

0

The Script doesent work and I put it in starterplayerscripts, nothing showed up in the output too

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