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
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: If and Then(Problem II)

Previous Thread :: Next Thread 
KingJacko is not online. KingJacko
Joined: 20 Jun 2008
Total Posts: 3944
17 Jan 2014 08:00 PM
So earlier i had a post about If and Then statements. So i KNOW that its not the script, but its not working. Its suppose to script when you touch the part, it changes the text of a Gui. Well, its not working. Here is the script:

a = Script.Parent.Parent
b = game.StarterGui.IslandChecker.Frame.TextLabel
function onTouched(hit)
if a.Name == "Hi" then
b.Text = "Hi"
elseif a.Name == "Bye" then
b.Text = "Bye"
end
end

script.Parent.Touched:connect(onTouched)

No red lines, and output says absolutely nothing

Report Abuse
VoidShredder is not online. VoidShredder
Joined: 06 Jan 2014
Total Posts: 1467
17 Jan 2014 08:08 PM
Changing the StarterGui wont help. IT does nothing.
Report Abuse
Azureous is not online. Azureous
Joined: 29 Jan 2012
Total Posts: 25287
17 Jan 2014 08:10 PM
--Touched Function
--for loop (:GetPlayers())
--PlayerGui editing
--Connect Touched w/ Event
Report Abuse
KingJacko is not online. KingJacko
Joined: 20 Jun 2008
Total Posts: 3944
17 Jan 2014 08:10 PM
What are you both trying to say
Report Abuse
KingJacko is not online. KingJacko
Joined: 20 Jun 2008
Total Posts: 3944
17 Jan 2014 08:15 PM
hellooooooo bumpity
Report Abuse
KingJacko is not online. KingJacko
Joined: 20 Jun 2008
Total Posts: 3944
18 Jan 2014 07:06 AM
bump
Report Abuse
qdhxx is not online. qdhxx
Joined: 02 Jul 2010
Total Posts: 56658
18 Jan 2014 07:22 AM
Is the block's name "Hi"?
It must be Hi to make to script work.

And if you want it to say "Bye", the block must be called "Bye".
Report Abuse
KingJacko is not online. KingJacko
Joined: 20 Jun 2008
Total Posts: 3944
18 Jan 2014 07:23 AM
yes they are called Hi and Bye
Report Abuse
vlekje513 is not online. vlekje513
Joined: 28 Dec 2010
Total Posts: 9057
18 Jan 2014 07:24 AM
StarterGui just copies all guis to the players PlayerGui ( Member of Player ) when they spawn.

Changing it will only change it when you spawn again.


You have to get the Player, then change the PlayerGui's child ( what the gui is called ).

So, do you want to change every player's PlayerGui or just one?
Report Abuse
KingJacko is not online. KingJacko
Joined: 20 Jun 2008
Total Posts: 3944
18 Jan 2014 07:25 AM
so b(the variable) would really have to equal (hit).PlayerGui.IslandChecker.TextLabel?
Report Abuse
KingJacko is not online. KingJacko
Joined: 20 Jun 2008
Total Posts: 3944
18 Jan 2014 07:28 AM
isnt (hit) what hit the block in this script? Because i did this to try something out once.

(hit):Remove

and it worked
Report Abuse
vlekje513 is not online. vlekje513
Joined: 28 Dec 2010
Total Posts: 9057
18 Jan 2014 07:29 AM
Yes.

But do you want to change everyone's PlayerGui or just one?

And (hit) is what hitted the block indeed.
Report Abuse
KingJacko is not online. KingJacko
Joined: 20 Jun 2008
Total Posts: 3944
18 Jan 2014 07:31 AM
i want to change the players gui so one person could be on the "Hi" island and the gui will say Hi. Then another could be on the "Bye" island and his will say Bye
Report Abuse
vlekje513 is not online. vlekje513
Joined: 28 Dec 2010
Total Posts: 9057
18 Jan 2014 07:36 AM
Ok, which players are they?
And how do you index them?
Report Abuse
KingJacko is not online. KingJacko
Joined: 20 Jun 2008
Total Posts: 3944
18 Jan 2014 07:37 AM
i dont mean specific players, just the ones that touch the island.
Report Abuse
KingJacko is not online. KingJacko
Joined: 20 Jun 2008
Total Posts: 3944
18 Jan 2014 07:40 AM
here let me rephrase my problem(even tho its already half solved).

I'm working on a script that when you touch a brick with the name of Hi or Bye, it will change the text of the persons gui.
Report Abuse
KingJacko is not online. KingJacko
Joined: 20 Jun 2008
Total Posts: 3944
18 Jan 2014 07:43 AM
so i only want to change one
Report Abuse
vlekje513 is not online. vlekje513
Joined: 28 Dec 2010
Total Posts: 9057
18 Jan 2014 07:47 AM
a = Script.Parent.Parent

function onTouched(hit)
if hit.Parent.Humanoid then -- makes sure the block who touched the block has an humanoid, so is a player
b = hit.Parent:GetPlayerFromCharacter -- gets player from the character
if a.Name == "Hi" then -- if the scripts parent.parent name is "Hi" then it will launch
b.PlayerGui.IslandChecker.Frame.TextLabel.Text = "Hi" -- changes the players PlayerGui into that.
elseif a.Name == "Bye" then
b.PlayerGui.IslandChecker.Frame.TextLabel.Text = "Bye"
end
end

script.Parent.Touched:connect(onTouched)


Try this
Report Abuse
KingJacko is not online. KingJacko
Joined: 20 Jun 2008
Total Posts: 3944
18 Jan 2014 07:51 AM
Nope. Doesnt work
Report Abuse
KingJacko is not online. KingJacko
Joined: 20 Jun 2008
Total Posts: 3944
18 Jan 2014 07:52 AM
wait ive got a red line, let me fix it
Report Abuse
KingJacko is not online. KingJacko
Joined: 20 Jun 2008
Total Posts: 3944
18 Jan 2014 07:53 AM
if a.Name == "Hi" then

thats the line i got a red line under :\
Report Abuse
KingJacko is not online. KingJacko
Joined: 20 Jun 2008
Total Posts: 3944
18 Jan 2014 07:54 AM
how would i fix that
Report Abuse
vlekje513 is not online. vlekje513
Joined: 28 Dec 2010
Total Posts: 9057
18 Jan 2014 07:58 AM
a = Script.Parent.Parent

function onTouched(hit)
if hit.Parent.Humanoid then -- makes sure the block who touched the block has an humanoid, so is a player
b = hit.Parent:GetPlayerFromCharacter() -- gets player from the character
if a.Name == "Hi" then -- if the scripts parent.parent name is "Hi" then it will launch
b.PlayerGui.IslandChecker.Frame.TextLabel.Text = "Hi" -- changes the players PlayerGui into that.
elseif a.Name == "Bye" then
b.PlayerGui.IslandChecker.Frame.TextLabel.Text = "Bye"
end
end

script.Parent.Touched:connect(onTouched)

Try this then
Report Abuse
Kingmouli is not online. Kingmouli
Joined: 28 Sep 2012
Total Posts: 1292
18 Jan 2014 07:59 AM
Try adding an end. Or just try this.

script.Parent.Touched:connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
plyr = game.Players:GetPlayerFromCharacter(hit.Parent)
plyr.PlayerGui.YOURGUI.Text = "Hi/Bye"
end
end)

Note: You'll have to edit this script.
Report Abuse
KingJacko is not online. KingJacko
Joined: 20 Jun 2008
Total Posts: 3944
18 Jan 2014 07:59 AM
red line under this now:

script.Parent.Touched:connect(onTouched)
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