|
| 16 Jan 2012 03:09 PM |
function output()
local playergui = game.Players..player..PlayerGui.ZorkGui
playergui.Frame.Location.Text = "Location: North of House"
end
function onHit(hit) if (hit.Parent:FindFirstChild("Humanoid") ~= nil) and enabled then local player = hit.Parent:FindFirstChild("Humanoid").Name output() end end
script.Parent.Touched:connect(onHit)
It's supposed to change GUI text when you touch brick. It's for my Zork game. |
|
|
| Report Abuse |
|
|
| |
|
|
| 16 Jan 2012 03:12 PM |
Ah, I forgot to say:
There was no error in output, anyway. |
|
|
| Report Abuse |
|
|
|
| 16 Jan 2012 03:13 PM |
| For one, you put two periods when you only needed one, twice. |
|
|
| Report Abuse |
|
|
|
| 16 Jan 2012 03:16 PM |
You mean this way?
local playergui = game.Players..player.PlayerGui.ZorkGui
Or:
local playergui = game.Players.player..PlayerGui.ZorkGui
Or even
local playergui = game.Players.player.PlayerGui.ZorkGui |
|
|
| Report Abuse |
|
|
|
| 16 Jan 2012 03:18 PM |
^ I don't think that's what he wanted.
If I'm right on what you want to do this should be it:
local playergui = game.Players:FindFirstChild(player)PlayerGui.ZorkGui
And change the 'player' variable to this:
local player = hit.Parent.Name
[The silence answered my question.] |
|
|
| Report Abuse |
|
|
|
| 16 Jan 2012 03:19 PM |
Late post X_X, that was meant to Knightmare.
[The silence answered my question.] |
|
|
| Report Abuse |
|
|
|
| 16 Jan 2012 03:22 PM |
RATEX, thanks. But, now, I have another problem:
Workspace.NorthofHouse.Script:5: '=' expected near 'playergui'
|
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 16 Jan 2012 03:29 PM |
If I am right the script should be this:
local player = nil local enabled = true
function output()
local playergui = game.Players:findFirstChild(player).PlayerGui.ZorkGui
playergui.Frame.Location.Text = "Location: North of House"
end
function onHit(hit) if (hit.Parent:FindFirstChild("Humanoid")) and enabled then player = hit.Parent.Name output() enabled = false wait(3) enabled = true end end
script.Parent.Touched:connect(onHit) |
|
|
| Report Abuse |
|
|
|
| 16 Jan 2012 03:32 PM |
| Oh, if some zombies or moving stuff touch this with a thing named humanoid in it, the script will break. |
|
|
| Report Abuse |
|
|
|
| 16 Jan 2012 03:32 PM |
| Why is there a "wait (3)"? |
|
|
| Report Abuse |
|
|
|
| 16 Jan 2012 03:33 PM |
@Luke thanks for fixing it I forgot to point that out =/
[The silence answered my question.] |
|
|
| Report Abuse |
|
|
|
| 16 Jan 2012 03:33 PM |
| And it did not work, either. |
|
|
| Report Abuse |
|
|
|
| 16 Jan 2012 03:34 PM |
| And there was no error, and it didn't work. Darn... |
|
|
| Report Abuse |
|
|
|
| 16 Jan 2012 03:36 PM |
-Zork Gui --Desc --Frame ---Location <------- IS A TEXT! I NEED TO CHANGE THIS WHEN YOU TOUCH SCRIPT PARENT'S BRICK.
--CloseDetails --OpenDetails |
|
|
| Report Abuse |
|
|
lucas668
|
  |
| Joined: 18 Jun 2008 |
| Total Posts: 6183 |
|
|
| 16 Jan 2012 03:48 PM |
You guys should fix this if you actually know what your doing... >.>
function output(player)
local playergui = game.Players[player].PlayerGui.ZorkGui
playergui.Frame.Location.Text = "Location: North of House"
end
function parttouched(part) wait() if part.Parent then if part.Parent:FindFirstChild("Humanoid") and game.Players:FindFirstChild(part.Parent.Name) then output(game.Players[part.Parent.Name]) end end end
|
|
|
| Report Abuse |
|
|
lucas668
|
  |
| Joined: 18 Jun 2008 |
| Total Posts: 6183 |
|
|
| 16 Jan 2012 03:49 PM |
Forgot connection line, add this to the end of my previous post:
script.Parent.Touched:connect(parttouched)
|
|
|
| Report Abuse |
|
|
|
| 16 Jan 2012 03:51 PM |
Lucas! There's other problem:
Augh.
Workspace.WestofHouse.Script:3: bad argument #2 to '?' (string expected, got userdata)
|
|
|
| Report Abuse |
|
|
sharky99
|
  |
| Joined: 18 Dec 2008 |
| Total Posts: 3364 |
|
|
| 16 Jan 2012 03:54 PM |
function output(player) local playergui = game.Players[player].PlayerGui.ZorkGui playergui.Frame.Location.Text = "Location: North of House" end
script.Parent.Touched:connect(function(hit) h=hit.Parent:FindFirstChild("Humanoid") if h then local player = h.Parent.Name output(player) end end)
|
|
|
| Report Abuse |
|
|
| |
|
| |
|
sharky99
|
  |
| Joined: 18 Dec 2008 |
| Total Posts: 3364 |
|
|
| 16 Jan 2012 03:57 PM |
| Lucas, you totally screwed that up, you indexed the player twice. |
|
|
| Report Abuse |
|
|
lucas668
|
  |
| Joined: 18 Jun 2008 |
| Total Posts: 6183 |
|
|
| 16 Jan 2012 04:06 PM |
| Lol, sorry I'm a bit drowsy today, not thinking right... >.< |
|
|
| Report Abuse |
|
|