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

Part of the script doesn't work, help?

Asked by 10 years ago

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

01script.Parent.MouseClick:connect(function(open)
02    if script.Parent.Parent.Parent.door.Transparency == 0 and script.Parent.Parent.CanCollide == true then
03        script.Parent.Parent.Parent.door.Transparency = 1
04        script.Parent.Parent.Parent.door.CanCollide = false
05        wait(5)
06        script.Parent.Parent.Parent.door.CanCollide = true
07        script.Parent.Parent.Parent.door.Transparency = 0
08    elseif script.Parent.Parent.Transparency == 1 and script.Parent.Parent.CanCollide == false then
09        m = Instance.new("Message", open.PlayerGui)
10        m.Name = "Pm"
11        m.Text = "This door is already open."
12        wait(3)
13        m:Destroy()
14    end
15end)

script > ClickDetector > door ^ Thats whats in workspace.

1 answer

Log in to vote
0
Answered by 10 years ago

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.

0
umm if I change this into a local script and use local player, will that work? Operation_Meme 890 — 10y
0
It has nothing to do with localscripts. You gotta use the FindFirstChild(PLAYERSNAME), and so on. adspace44 20 — 10y
Ad

Answer this question