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

Part of the script doesn't work, help?

Alright, this script works sort of, but it doesnt generate a message into the playergui after elseif. Does anyone know why? script:

script.Parent.MouseClick:connect(function(open)
	if script.Parent.Parent.Parent.door.Transparency == 0 and script.Parent.Parent.CanCollide == true then
		script.Parent.Parent.Parent.door.Transparency = 1
		script.Parent.Parent.Parent.door.CanCollide = false
		wait(5)
		script.Parent.Parent.Parent.door.CanCollide = true
		script.Parent.Parent.Parent.door.Transparency = 0
	elseif script.Parent.Parent.Transparency == 1 and script.Parent.Parent.CanCollide == false then
		m = Instance.new("Message", open.PlayerGui)
		m.Name = "Pm"
		m.Text = "This door is already open."
		wait(3)
		m:Destroy()
	end
end)

script > ClickDetector > door ^ Thats whats in workspace.

1 answer

Its because when you click the part, and you declare "open", you are meaning the physical person that clicked the part. In short, the open argument is the person in workspace. Somehow, you need to take the persons name, find it in Players, then find their PlayerGui, THEN insert it there.

2 comments

0

umm if I change this into a local script and use local player, will that work?

0

It has nothing to do with localscripts. You gotta use the FindFirstChild(PLAYERSNAME), and so on.

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