generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
We use cookies to offer you a better experience. By using Roblox.com, you are agreeing to our Privacy and Cookie Policy.
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: This is correct way? <------------------------------

Previous Thread :: Next Thread 
LightedRoblox is not online. LightedRoblox
Joined: 16 Apr 2010
Total Posts: 6235
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
LightedRoblox is not online. LightedRoblox
Joined: 16 Apr 2010
Total Posts: 6235
16 Jan 2012 03:12 PM
So, what I do?
Report Abuse
LightedRoblox is not online. LightedRoblox
Joined: 16 Apr 2010
Total Posts: 6235
16 Jan 2012 03:12 PM
Ah, I forgot to say:

There was no error in output, anyway.
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
16 Jan 2012 03:13 PM
For one, you put two periods when you only needed one, twice.
Report Abuse
LightedRoblox is not online. LightedRoblox
Joined: 16 Apr 2010
Total Posts: 6235
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
RATEXmegaGAMER is not online. RATEXmegaGAMER
Joined: 10 Dec 2010
Total Posts: 4046
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
RATEXmegaGAMER is not online. RATEXmegaGAMER
Joined: 10 Dec 2010
Total Posts: 4046
16 Jan 2012 03:19 PM
Late post X_X, that was meant to Knightmare.

[The silence answered my question.]
Report Abuse
LightedRoblox is not online. LightedRoblox
Joined: 16 Apr 2010
Total Posts: 6235
16 Jan 2012 03:22 PM
RATEX, thanks. But, now, I have another problem:


Workspace.NorthofHouse.Script:5: '=' expected near 'playergui'
Report Abuse
LightedRoblox is not online. LightedRoblox
Joined: 16 Apr 2010
Total Posts: 6235
16 Jan 2012 03:26 PM
... Anyone?
Report Abuse
LightedRoblox is not online. LightedRoblox
Joined: 16 Apr 2010
Total Posts: 6235
16 Jan 2012 03:29 PM
Anyone? :o
Report Abuse
Lukekneenew is not online. Lukekneenew
Joined: 20 Oct 2009
Total Posts: 746
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
Lukekneenew is not online. Lukekneenew
Joined: 20 Oct 2009
Total Posts: 746
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
LightedRoblox is not online. LightedRoblox
Joined: 16 Apr 2010
Total Posts: 6235
16 Jan 2012 03:32 PM
Why is there a "wait (3)"?
Report Abuse
RATEXmegaGAMER is not online. RATEXmegaGAMER
Joined: 10 Dec 2010
Total Posts: 4046
16 Jan 2012 03:33 PM
@Luke thanks for fixing it I forgot to point that out =/

[The silence answered my question.]
Report Abuse
LightedRoblox is not online. LightedRoblox
Joined: 16 Apr 2010
Total Posts: 6235
16 Jan 2012 03:33 PM
And it did not work, either.
Report Abuse
LightedRoblox is not online. LightedRoblox
Joined: 16 Apr 2010
Total Posts: 6235
16 Jan 2012 03:34 PM
And there was no error, and it didn't work. Darn...
Report Abuse
LightedRoblox is not online. LightedRoblox
Joined: 16 Apr 2010
Total Posts: 6235
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 is not online. 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 is not online. 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
LightedRoblox is not online. LightedRoblox
Joined: 16 Apr 2010
Total Posts: 6235
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 is not online. 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
LightedRoblox is not online. LightedRoblox
Joined: 16 Apr 2010
Total Posts: 6235
16 Jan 2012 03:56 PM
Sharky99's version WORKS!
Report Abuse
LightedRoblox is not online. LightedRoblox
Joined: 16 Apr 2010
Total Posts: 6235
16 Jan 2012 03:57 PM
Thanks sharky99. :D
Report Abuse
sharky99 is not online. 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 is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image