|
| 10 May 2015 09:16 PM |
I made a ClickDetector Part that when you click, is supposed to move a gui onto the screen. I've done it multiple times and it usually works, but for some reason this script doesn't do anything when you click it. Here's the script:
script.Parent.ClickDetector.MouseClick:connect(function(click) local v = game.Players:FindFirstChild(click.Name) local main = v.PlayerGui.Pets.Main if main then main:TweenPosition(UDim2.new(0.5,0,0.5,0),"In","Bounce",2,true) end end)
|
|
|
| Report Abuse |
|
|
|
| 10 May 2015 09:20 PM |
| "main" doesn't look like it would return as a boolean... You should try "local main = v.PlayerGui.Pets:FindFirstChild("Main")" |
|
|
| Report Abuse |
|
|
|
| 10 May 2015 09:23 PM |
I changed it to this:
script.Parent.ClickDetector.MouseClick:connect(function(click) local v = game.Players:FindFirstChild(click.Name) local main = v.PlayerGui.Pets:FindFirstChild("Main") if main.Visible == true then main:TweenPosition(UDim2.new(0.5,0,0.5,0),"In","Bounce",2,true) end end)
There's no error, yet it does nothing. |
|
|
| Report Abuse |
|
|
|
| 10 May 2015 09:24 PM |
| What is main exactly? Like what is the Class Name? |
|
|
| Report Abuse |
|
|
|
| 10 May 2015 09:25 PM |
| Pets = ScreenGui, Main = Frame |
|
|
| Report Abuse |
|
|
|
| 10 May 2015 09:32 PM |
I tried printing some stuff in the script but nothing prints when I click it... Nut yet there's no error :/
script.Parent.ClickDetector.MouseClick:connect(function(click) local v = game.Players:FindFirstChild(click.Name) print(click.Name) local main = v.PlayerGui.Pets:FindFirstChild("Main") print(main.Parent.Name) if main.Visible == true then main:TweenPosition(UDim2.new(0.5,0,0.5,0),"In","Bounce",2,true) end end)
|
|
|
| Report Abuse |
|
|
| |
|
DevVince
|
  |
| Joined: 08 Nov 2008 |
| Total Posts: 9245 |
|
|
| 10 May 2015 09:51 PM |
Uhh you know with click detectors you don't need to find the player...
script.Parent.ClickDetector.MouseClick:connect(function(player)--Already there for you.. end)
|
|
|
| Report Abuse |
|
|