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 » Game Design
Home Search
 

Re: How do I make a script in a brick get startergui?

Previous Thread :: Next Thread 
BuilderBere is not online. BuilderBere
Joined: 25 Jan 2014
Total Posts: 3163
07 May 2017 07:58 PM
Like, I want a brick when on touched it can show up text from the startergui.

Here is an example if you don't know what I mean.

function onTouched(hit)
game.Workspace.OldDesk:Play()
game.StarterGui.ScreenGui.Frame.OldDeskScript.Disabled = false
script.Parent:Destroy()
end

script.Parent.Touched:connect(onTouched)

But it doesn't come up every single time I test it, may anybody help me with this? It would be greatly appreciated.


t
Report Abuse
SSSpencer413 is not online. SSSpencer413
Joined: 27 Jan 2016
Total Posts: 375
07 May 2017 09:44 PM
GUIs are local. You can do the 'Get Player From Character' function to get the player. You need a local script to change anything in the GUI.



Also, Starter Gui won't affect the player directly. They need to rest to see the effects. I hope that's what you want.


#code error('Signature not found!')
Report Abuse
cowsoncows is not online. cowsoncows
Joined: 11 Oct 2013
Total Posts: 2522
07 May 2017 10:05 PM
If you want it to affect a single player, you need to access the PlayerGui, located in the player.


Report Abuse
micheal999990 is not online. micheal999990
Joined: 22 Sep 2009
Total Posts: 355
08 May 2017 01:53 AM
Under your function which is function onTouched make a new statement called player like so. local Player = hit.Parent.Name
This is done to get the name of the player who hit the brick via their character. As you can't do local player in a normal script.

Replace game.startergui with game.Players.Player.PlayerGui as the startergui is a place to store gui's that will be passed down/ replicate to the player when the game starts or they respawn, not during gameplay.
Report Abuse
micheal999990 is not online. micheal999990
Joined: 22 Sep 2009
Total Posts: 355
08 May 2017 01:58 AM
Plus add a wait before you destroy the script. You don't give it time to actually perform the task you want it to do before you destroy it. 0.3 seconds would be sufficient.
Report Abuse
Naxxanar is not online. Naxxanar
Joined: 13 Jun 2012
Total Posts: 709
08 May 2017 05:37 AM
server script:
local Remote=Instance.new("RemoteEvent")
Remote.Name="Remote"
Remote.Parent=game:GetService("ReplicatedStorage")

script.Parent.Touched:Connect(function(Hit)
if game:GetService("Players"):GetPlayerFromCharacter(Hit.Parent) then
local Player=Players:GetPlayerFromCharacter(Hit.Parent)
Remote:FireClient(Player, "ShowGui")
end)

client script:
Remote.OnClientEvent:Connect(function(...)
local Tuple={...}
if Tuple[1]=="ShowGui" then
--// gui stuff
end
end)
Report Abuse
Naxxanar is not online. Naxxanar
Joined: 13 Jun 2012
Total Posts: 709
08 May 2017 05:38 AM
oops

client script:
local Remote=game:GetService("ReplicatedStorage"):WaitForChild("Remote")

Remote.OnClientEvent:Connect(function(...)
local Tuple={...}
if Tuple[1]=="ShowGui" then
--// gui stuff
end
end)
Report Abuse
Naxxanar is not online. Naxxanar
Joined: 13 Jun 2012
Total Posts: 709
08 May 2017 05:39 AM
go away plebs
Report Abuse
Roardorak is not online. Roardorak
Joined: 13 Jul 2014
Total Posts: 184
08 May 2017 05:55 AM
oh come on i was about to tell him to use a remote event for the server to tell the client what to do.

Ready the rifles, boys!
Report Abuse
Naxxanar is not online. Naxxanar
Joined: 13 Jun 2012
Total Posts: 709
08 May 2017 07:11 AM
>replies 20 minutes after what i said

u was about to tell him? ok.
Report Abuse
Roardorak is not online. Roardorak
Joined: 13 Jul 2014
Total Posts: 184
08 May 2017 03:19 PM
no i remembered the idea and came back to the post to tell him
Report Abuse
BuilderBere is not online. BuilderBere
Joined: 25 Jan 2014
Total Posts: 3163
08 May 2017 07:41 PM
@Naxxan

client script:
local Remote=game:GetService("ReplicatedStorage"):WaitForChild("Remote")

Remote.OnClientEvent:Connect(function(...)
local Tuple={...}
if Tuple[1]=="ShowGui" then
--// gui stuff
end
end)

What do you mean "--// gui stuff?"
Report Abuse
BuilderBere is not online. BuilderBere
Joined: 25 Jan 2014
Total Posts: 3163
08 May 2017 08:33 PM
To be honest, I really want the code of it, not hints, I'm really stressed out at this type of script.
Report Abuse
BuilderBere is not online. BuilderBere
Joined: 25 Jan 2014
Total Posts: 3163
08 May 2017 08:54 PM
1
Report Abuse
Naxxanar is not online. Naxxanar
Joined: 13 Jun 2012
Total Posts: 709
09 May 2017 11:00 PM
if Tuple[1]=="ShowGui" then
DatCoolGui.Visible=true
end
Report Abuse
Naxxanar is not online. Naxxanar
Joined: 13 Jun 2012
Total Posts: 709
09 May 2017 11:00 PM
if ur trying to make a frame visible, then do
if Tuple[1]=="ShowGui" then
DatCoolGuiFrame.Visible=true
end

if its a gui then do
if Tuple[1]=="ShowGui" then
DatCoolGui.Enabled=true
end
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Game Design
   
 
   
  • 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