|
script.Parent.ClickDetector.MouseClick:connect(function()
local gui = Instance.new("ScreenGui")
local msg = Instance.new("TextBox")
msg.Size = UDim2.new(1, 200, 1, 200)
msg.Position = UDim2.new(50, 50, 50, 50)
gui.Parent = game.Players.LocalPlayer.PlayerGui
msg.Parent = gui
msg.Text = "*Knock*"
wait(2)
msg.Text = "*Knock* *Knock*"
wait(2)
msg.Text = "*Knock* *Knock* *Knock*"
wait(3)
gui:remove()
end)
door = script.Parent
function clickit()
door.Transparency = 1
door.CanCollide = false
wait(15)
door.Transparency = 0
door.CanCollide = true
end
door.ClickDetector.MouseClick:connect(clickit)
.
.
.
.
.
.
(the dots arnt in it) the gui wont show... why???? |
|
|
omg no good scripters are online |
|
pighead10Join Date: 2009-05-03 Post Count: 10341 |
"omg no good scripters are online"
*ehem*
Post your output first... |
|
|
srry but no one was posting...any ways whats wrong? |
|
|
num = 1
door = script.Parent
script.Parent.ClickDetector.MouseClick:connect(function()
if num == 1 then
local gui = Instance.new("ScreenGui")
local msg = Instance.new("TextBox")
msg.Size = UDim2.new(1, 200, 1, 200)
gui.Parent = game.Players.LocalPlayer.PlayerGui
msg.Parent = gui
msg.Text = "*Knock*"
wait(2)
msg.Text = "*Knock* *Knock*"
wait(2)
msg.Text = "*Knock* *Knock* *Knock*"
wait(3)
gui:remove()
num = 2
elseif num == 2 then
door.Transparency = 1
door.CanCollide = false
wait(15)
door.Transparency = 0
door.CanCollide = true
num = 1
end
end)
|
|
pighead10Join Date: 2009-05-03 Post Count: 10341 |
output? |
|
|
wait is the guy above you right? |
|
|
Yes! -_- Im a good scripter also. |
|
pighead10Join Date: 2009-05-03 Post Count: 10341 |
It would probably work, but when you clicked it it would put the GUI up, then you'd have to click it again to get the door to work. |
|
|
so how would i make it so it would be 1 click? |
|
|
My script makes it so when you click the brick the message pops up then it goes away and when you click the brick again it opens. |
|
|
door = script.Parent
script.Parent.ClickDetector.MouseClick:connect(function()
local gui = Instance.new("ScreenGui")
local msg = Instance.new("TextBox")
msg.Size = UDim2.new(1, 200, 1, 200)
gui.Parent = game.Players.LocalPlayer.PlayerGui
msg.Parent = gui
msg.Text = "*Knock*"
wait(2)
msg.Text = "*Knock* *Knock*"
wait(2)
msg.Text = "*Knock* *Knock* *Knock*"
wait(3)
gui:remove()
num = 2
door.Transparency = 1
door.CanCollide = false
wait(15)
door.Transparency = 0
door.CanCollide = true
num = 1
end)
|
|
pighead10Join Date: 2009-05-03 Post Count: 10341 |
I think this would work, although I've only edited kirky's :/
door = script.Parent
script.Parent.ClickDetector.MouseClick:connect(function()
local rungui = coroutine.create(function()
local gui = Instance.new("ScreenGui")
local msg = Instance.new("TextBox")
msg.Size = UDim2.new(1, 200, 1, 200)
gui.Parent = game.Players.LocalPlayer.PlayerGui
msg.Parent = gui
msg.Text = "*Knock*"
wait(2)
msg.Text = "*Knock* *Knock*"
wait(2)
msg.Text = "*Knock* *Knock* *Knock*"
wait(3)
gui:remove()
end)
coroutine.resume(rungui)
door.Transparency = 1
door.CanCollide = false
wait(15)
door.Transparency = 0
door.CanCollide = true
end) |
|
pighead10Join Date: 2009-05-03 Post Count: 10341 |
@kirky
You forgot to remove all the num variables from the script, so it would error, and it would still complete one before the other. Mine would work, unless yours had a syntax error... |
|
|
Also brandon you made it a text box... Make it a textbutton. |
|
|
cd = script.Parent.ClickDetector
door = script.Parent
script.Parent.ClickDetector.MouseClick:connect(function()
cd.Parent = nil
local gui = Instance.new("ScreenGui")
local msg = Instance.new("TextButton")
msg.Size = UDim2.new(1, 200, 1, 200)
gui.Parent = game.Players.LocalPlayer.PlayerGui
msg.Parent = gui
msg.Text = "*Knock*"
wait(2)
msg.Text = "*Knock* *Knock*"
wait(2)
msg.Text = "*Knock* *Knock* *Knock*"
wait(3)
gui:remove()
door.Transparency = 1
door.CanCollide = false
wait(15)
door.Transparency = 0
door.CanCollide = true
cd.Parent =script.Parent
end)
|
|
|
|
I tested and it works! Did you even put in a click detector! |
|
|
yes i put in a click decetor show me the place you put it in |
|
zeke505Join Date: 2008-05-26 Post Count: 15765 |
You can't access LocalPlayer without a LocalScript.
LocalScripts only run as a descendant of a player. |
|
|
so i need to make a local script? can some one help me with one of them? XD zeke? |
|
zeke505Join Date: 2008-05-26 Post Count: 15765 |
Yes, it needs to be a localscript INSIDE THE PLAYER for it to work. |
|
|
zeke505Join Date: 2008-05-26 Post Count: 15765 |
... -.- |
|
|