Birdzy
|
  |
| Joined: 15 Jul 2011 |
| Total Posts: 285 |
|
|
| 15 Jun 2012 06:02 AM |
If I just change
function onTouched(hit)
to
function onClick()
and
script.Parent.Touched:connect(onTouched)
to
script.Parent.MouseButton1Down:connect(onClick)
Will the GUI button do the same thing it would if you stepped on that brick before? |
|
|
| Report Abuse |
|
|
|
| 15 Jun 2012 06:04 AM |
Do you mean GUI button as in Billboard GUIs?
☜▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬☜☆☞▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬☞ - Candymaniac, a highly reactive substance. |
|
|
| Report Abuse |
|
|
Nicolas77
|
  |
| Joined: 29 Jul 2008 |
| Total Posts: 3158 |
|
|
| 15 Jun 2012 06:06 AM |
| It depends what GUI you want. Also, you've gotta make sure you have the gui button script, too. |
|
|
| Report Abuse |
|
|
Birdzy
|
  |
| Joined: 15 Jul 2011 |
| Total Posts: 285 |
|
|
| 15 Jun 2012 06:09 AM |
| Confused... I fail at scripting. I want to change a brick with multiple very short scripts in them into scripts that will go in a GUI button instead. What GUI button script do I need too? |
|
|
| Report Abuse |
|
|
Birdzy
|
  |
| Joined: 15 Jul 2011 |
| Total Posts: 285 |
|
|
| 15 Jun 2012 06:14 AM |
function onTouched(hit) wait(0) if hit.Parent:findFirstChild("Humanoid") ~= nil and hit.Parent:findFirstChild("Arm1") ~= nil then local g = hit.Parent.Arm1:remove() if hit.Parent:findFirstChild("Humanoid") ~= nil and hit.Parent:findFirstChild("Arm2") ~= nil then local g = hit.Parent.Arm2:remove() end end end
script.Parent.Touched:connect(onTouched)
Gotta make this a GUI. |
|
|
| Report Abuse |
|
|
Cheater
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 5258 |
|
|
| 15 Jun 2012 06:17 AM |
| You forget that "hit" is not the same on a MouseButton1Down event. |
|
|
| Report Abuse |
|
|
Birdzy
|
  |
| Joined: 15 Jul 2011 |
| Total Posts: 285 |
|
|
| 15 Jun 2012 06:17 AM |
| I can see all the little 'hit's. Those probably have to change too... |
|
|
| Report Abuse |
|
|
Birdzy
|
  |
| Joined: 15 Jul 2011 |
| Total Posts: 285 |
|
|
| 15 Jun 2012 06:18 AM |
| All I know about scripting is what I've seen in scripts and a few little wiki pages about it. I don't know how to very well. |
|
|
| Report Abuse |
|
|
Cheater
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 5258 |
|
|
| 15 Jun 2012 06:25 AM |
I don't know how your GUI looks like and where it's exactly placed so you have to change the Parent's of the path there until it matches. I thought it will look like this:
--game.Player.PlayerGui.ScreenGui.Frame.TextButton
character = script.Parent.Parent.Parent.Parent.Parent.Character --CHANGE THAT HERE
function onClicked() wait(0) if character:findFirstChild("Humanoid") ~= nil and character:findFirstChild("Arm1") ~= nil then local g = character.Arm1:remove() if character:findFirstChild("Humanoid") ~= nil and character:findFirstChild("Arm2") ~= nil then local g = character.Arm2:remove() end end end
script.Parent.MouseButton1Down:connect(onClicked)
|
|
|
| Report Abuse |
|
|
Cheater
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 5258 |
|
|
| 15 Jun 2012 06:26 AM |
Just some unnecessary fix:
--game.Players.Player.PlayerGui.ScreenGui.Frame.TextButton.Script
character = script.Parent.Parent.Parent.Parent.Parent.Character --CHANGE THAT HERE
function onClicked() wait(0) if character:findFirstChild("Humanoid") ~= nil and character:findFirstChild("Arm1") ~= nil then local g = character.Arm1:remove() if character:findFirstChild("Humanoid") ~= nil and character:findFirstChild("Arm2") ~= nil then local g = character.Arm2:remove() end end end
script.Parent.MouseButton1Down:connect(onClicked) |
|
|
| Report Abuse |
|
|
Birdzy
|
  |
| Joined: 15 Jul 2011 |
| Total Posts: 285 |
|
|
| 15 Jun 2012 06:36 AM |
| Thank you! I'll figure out the whole parent thing... |
|
|
| Report Abuse |
|
|
Birdzy
|
  |
| Joined: 15 Jul 2011 |
| Total Posts: 285 |
|
|
| 15 Jun 2012 06:46 AM |
Urf- another script that's different from the others.
function onTouched(hit) if hit.Parent:findFirstChild("Humanoid") ~= nil and hit.Parent:findFirstChild("Chest") ~= nil then local g = hit.Parent.Chest:remove() g.Parent = hit.Parent local C = g:GetChildren() for i=1, #C do if C[i].className == "Part" then local W = Instance.new("Weld") W.Part0 = g.Middle W.Part1 = C[i] local CJ = CFrame.new(g.Middle.Position) local C0 = g.Middle.CFrame:inverse()*CJ local C1 = C[i].CFrame:inverse()*CJ W.C0 = C0 W.C1 = C1 W.Parent = g.Middle end local Y = Instance.new("Weld") Y.Part0 = hit.Parent.Torso Y.Part1 = g.Middle Y.C0 = CFrame.new(0, 0, 0) Y.Parent = Y.Part0 end
local h = g:GetChildren() for i = 1, # h do h[i].Anchored = false h[i].CanCollide = false end end end
script.Parent.Touched:connect(onTouched) |
|
|
| Report Abuse |
|
|
Cheater
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 5258 |
|
|
| 15 Jun 2012 06:50 AM |
I hate Welds. -.-
character = script.Parent.Parent.Parent.Parent.Parent.Character --once again set the parent's correct
function onClicked() if character:findFirstChild("Humanoid") ~= nil and character:findFirstChild("Chest") ~= nil then local g = character.Chest:remove() g.Parent = character local C = g:GetChildren() for i=1, #C do if C[i].className == "Part" then local W = Instance.new("Weld") W.Part0 = g.Middle W.Part1 = C[i] local CJ = CFrame.new(g.Middle.Position) local C0 = g.Middle.CFrame:inverse()*CJ local C1 = C[i].CFrame:inverse()*CJ W.C0 = C0 W.C1 = C1 W.Parent = g.Middle end local Y = Instance.new("Weld") Y.Part0 = character.Torso Y.Part1 = g.Middle Y.C0 = CFrame.new(0, 0, 0) Y.Parent = Y.Part0 end
local h = g:GetChildren() for i = 1, # h do h[i].Anchored = false h[i].CanCollide = false end
end end
script.Parent.MouseButton1Down:connect(onClicked)
Try understanding it. It's almost the same like the one before. |
|
|
| Report Abuse |
|
|