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 » Scripters
Home Search
 

Re: Okay I give up! Someone help me out.

Previous Thread :: Next Thread 
kell1300 is not online. kell1300
Joined: 01 Jan 2009
Total Posts: 66
31 Mar 2016 11:28 PM
I made a script to insert a click detector in a part for my game. When you click on that part, it shows you my shop Gui. The script works just fine when I first join, but when I die or reset, the Gui won't show back up. I've been trying to fix this for going 4 hours, and I still can't find the problem.

Here is the code:

clickDetector = Instance.new("ClickDetector")
clickDetector.Parent = game.Workspace.Robloxian.Head
clickDetector = true

clickDetector.MouseClick:connect(function(hit)
script.Parent.Parent.Character.Humanoid.WalkSpeed = 0
script.Parent.Parent.PlayerGui.Shop.Background.Visible = true
end





Report Abuse
Flux_Capacitor is not online. Flux_Capacitor
Joined: 07 Apr 2008
Total Posts: 45720
31 Mar 2016 11:30 PM
"clickDetector = true"
You destroyed the reference to the actual ClickDetector when you did that.
Report Abuse
RPG_Dev is not online. RPG_Dev
Joined: 19 Nov 2011
Total Posts: 419
31 Mar 2016 11:30 PM
if the script is in the workspace its because it only runs once


Report Abuse
RPG_Dev is not online. RPG_Dev
Joined: 19 Nov 2011
Total Posts: 419
31 Mar 2016 11:31 PM
woops nvm read it wrong :C


Report Abuse
Darkenus is not online. Darkenus
Joined: 17 Jul 2014
Total Posts: 1997
31 Mar 2016 11:32 PM
Okay, so I have A LOT of questions.

Starting with:

"clickDetector = true"

1. what exactly is that supposed to be?

2. secondly, you are inserting a clickdetector everytime the player resets? (because guis reset everytime character is respawned)

3. is the shop gui in startergui? or is it added everytime a player joins?

4. what kind of script is this? (local/normal)
Report Abuse
kell1300 is not online. kell1300
Joined: 01 Jan 2009
Total Posts: 66
31 Mar 2016 11:35 PM
@Darkenus

1. I forgot to delete that from something I tried earlier

2. I think believe so

3. It's in my starterGui

4. Local


Report Abuse
2013henry is not online. 2013henry
Joined: 09 Apr 2013
Total Posts: 39768
31 Mar 2016 11:36 PM
Gotta script, script, script everyday! I use Lua, you use Java! Trolololoololol!
Report Abuse
Darkenus is not online. Darkenus
Joined: 17 Jul 2014
Total Posts: 1997
31 Mar 2016 11:44 PM
Try this:

local parent = game.Workspace:WaitForChild("Robloxian"):WaitForChild("Head")
local clickDetector = parent:FindFirstChild("ClickDetector")

if not clickDetector then
clickDetector = Instance.new("ClickDetector", parent)
end

clickDetector.MouseClick:connect(function(hit)
script.Parent.Parent.Character.Humanoid.WalkSpeed = 0
script.Parent.Parent.PlayerGui.Shop.Background.Visible = true
end)
Report Abuse
kell1300 is not online. kell1300
Joined: 01 Jan 2009
Total Posts: 66
31 Mar 2016 11:47 PM
@Darkenus
It worked! Thanks for the help!


Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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