|
| 07 Jul 2011 04:00 PM |
This script spawns a transparent model to a location when the mouse enters the Gui, and removes it when the mouse leaves the Gui. Take a look:
MyGarage = workspace[""..script.Parent.Parent.Parent.Parent.Name.."_Garage"]
for _,v in pairs(script.Parent:GetChildren()) do if v:FindFirstChild("CarBaseValue") then v.MouseEnter:connect(function(Click) Clone = v.CarBaseValue.Value Cloned = game.Lighting.Clone:Clone() for i = 1,#Cloned do if Cloned[i]:IsA("Part") then Cloned[i].TransParency = 0.5 Cloned[i].Anchored = true wait() end end Cloned.Parent = MyGarage Cloned:MoveTo(MyGarage.PlatForm.Position) Cloned:MakeJoints() end) end end
for _,v in pairs(script.Parent:GetChildren()) do if v:FindFirstChild("CarBaseValue") then v.MouseLeave:connect(function(Click) Cloned:Remove() end) end end |
|
|
| Report Abuse |
|
|
|
| 07 Jul 2011 04:02 PM |
| Maybe where I cloned and made the model is where the error might be located, |
|
|
| Report Abuse |
|
|
|
| 07 Jul 2011 04:07 PM |
Here's an edit, still not working though
MyGarage = workspace[""..script.Parent.Parent.Parent.Parent.Name.."_Garage"]
for _,v in pairs(script.Parent:GetChildren()) do if v:FindFirstChild("CarBaseValue") then v.MouseEnter:connect(function(Click) Clone = v.CarBaseValue.Value Cloned = game.Lighting[Clone]:Clone() for i = 1,#Cloned do if Cloned[i]:IsA("Part") then Cloned[i].TransParency = 0.5 Cloned[i].Anchored = true wait() end end Cloned.Parent = MyGarage Cloned:MoveTo(MyGarage.PlatForm.Position) Cloned:MakeJoints() end) end end
for _,v in pairs(script.Parent:GetChildren()) do if v:FindFirstChild("CarBaseValue") then v.MouseLeave:connect(function(Click) Cloned:Remove() end) end end |
|
|
| Report Abuse |
|
|
|
| 07 Jul 2011 04:11 PM |
This script isn't very complicated, in fact it's very easy to disect
*Spy voice* "A little assistance?" |
|
|
| Report Abuse |
|
|
|
| 07 Jul 2011 04:18 PM |
I tried to debug it with print, even the first print didn't register so the script isn't running
PS guys, stop making me talk to myself :P |
|
|
| Report Abuse |
|
|
|
| 07 Jul 2011 04:21 PM |
I've never used GUI's before, but I'll try to help. :P Where in the code was the print anyway? |
|
|
| Report Abuse |
|
|
|
| 07 Jul 2011 04:23 PM |
Every line :P
You know luffy, this is coding for your idea that you gave my for designing your own car |
|
|
| Report Abuse |
|
|
|
| 07 Jul 2011 04:27 PM |
Yeah, I noticed when I saw the word 'garage'. And you're saying the script doesn't even get past defining the variable? Is the script disabled? |
|
|
| Report Abuse |
|
|
| |
|
|
| 07 Jul 2011 04:30 PM |
Ok then... Is the script a LocalScript? It might be under the wrong parent if it is. If that isn't the case, then I have no clue what might be the problem. :o |
|
|
| Report Abuse |
|
|
|
| 07 Jul 2011 04:31 PM |
| It's a normal script. I only use Local script if I need Camera positioning |
|
|
| Report Abuse |
|
|
Horanoven
|
  |
| Joined: 11 Jul 2008 |
| Total Posts: 11034 |
|
|
| 07 Jul 2011 04:34 PM |
1: "TransParency"? Whats with the Capital P?
2: I haven't worked much with GUIs. When I run into a problem where I don't get an output, I generally put "print("#")" under lines with if, for, while, function, ect. I'm sorry if you've already tried this, but thats all I can offer. |
|
|
| Report Abuse |
|
|
|
| 07 Jul 2011 04:36 PM |
| It still doesn't work, but yes, that transparency was wrong |
|
|
| Report Abuse |
|
|
Horanoven
|
  |
| Joined: 11 Jul 2008 |
| Total Posts: 11034 |
|
|
| 07 Jul 2011 04:37 PM |
| Check where the "prints" stop. |
|
|
| Report Abuse |
|
|
|
| 07 Jul 2011 04:42 PM |
Fixed alot of it now, having trouble with the for loop;
for _,v in pairs(script.Parent:GetChildren()) do if v:FindFirstChild("CarBaseValue") then v.MouseEnter:connect(function() MyGarage = workspace[""..script.Parent.Parent.Parent.Parent.Name.."_Garage"] Clone = v.CarBaseValue.Value Cloned = game.Lighting[Clone]:Clone() Cloned.Parent = MyGarage Cloned:MoveTo(MyGarage.PlatForm.Position)
for i = 1,#Cloned do --HERE: Players.Player.PlayerGui.ScreenGui.CarBase.Script:9: attempt to get length of global 'Cloned' (a userdata value)
if Cloned[i]:IsA("Part") then Cloned[i].Transparency = 0.5 Cloned[i].Anchored = true wait() end Cloned:MakeJoints() end end) end end
for _,v in pairs(script.Parent:GetChildren()) do if v:FindFirstChild("CarBaseValue") then v.MouseLeave:connect(function() Cloned:Remove() end) end end |
|
|
| Report Abuse |
|
|
|
| 07 Jul 2011 04:50 PM |
| Cloned isn't a table. (I'm not the best scripter, so I may be missing something.) |
|
|
| Report Abuse |
|
|
|
| 07 Jul 2011 04:52 PM |
| I fixed it all, thanks guy, good night |
|
|
| Report Abuse |
|
|