hawk2eye
|
  |
| Joined: 03 May 2010 |
| Total Posts: 8525 |
|
|
| 10 Sep 2014 09:40 AM |
I've basically changed a script and tried to make it so "OnClicked" the function will work.
The thing I'm attempting to make it click is a surface GUI button. The surface gui is on a brick and the script is in the surface gui
-- Script by Hawk2Eye
timeuntilwin = 5 totaltime = 5
raidteamcolor = "Bright green" defendteamcolor = "Bright red" h = Instance.new("Hint")
function OnClicked(clicked)
if clicked.Parent:findFirstChild("Humanoid") ~= nil then if game.Players:GetPlayerFromCharacter(clicked.Parent).TeamColor == BrickColor.new(raidteamcolor) then script.Parent.BrickColor = BrickColor.new(raidteamcolor) end if game.Players:GetPlayerFromCharacter(clicked.Parent).TeamColor == BrickColor.new(defendteamcolor) then script.Parent.BrickColor = BrickColor.new(defendteamcolor) timeuntilwin = totaltime for i, v in pairs(game.Workspace:GetChildren()) do if v:IsA("Hint") then v:remove() end end end
end
end
script.Parent.Clicked:connect(OnClicked)
while true do wait() if script.Parent.BrickColor == BrickColor.new(raidteamcolor) then h.Parent = game.Workspace h.Text = "The Raiders will win in".." "..timeuntilwin
if timeuntilwin <= totaltime and timeuntilwin > 0 then wait(1) timeuntilwin = timeuntilwin - 1 end
if timeuntilwin == 0 then h:remove()
winmsg = Instance.new("Message") winmsg.Parent = game.Workspace winmsg.Text = "Raiders have won!" wait(2) winmsg:remove() script.Parent.BrickColor = BrickColor.new(defendteamcolor) timeuntilwin = totaltime end end end |
|
|
| Report Abuse |
|
|
|
| 10 Sep 2014 09:42 AM |
tldr which line is it erroring on
guise i have a siggy |
|
|
| Report Abuse |
|
|
hawk2eye
|
  |
| Joined: 03 May 2010 |
| Total Posts: 8525 |
|
|
| 10 Sep 2014 09:43 AM |
It doesn't tell me D:
Nothing is underlined and the output window isnt saying anything |
|
|
| Report Abuse |
|
|
vlekje518
|
  |
| Joined: 10 Apr 2011 |
| Total Posts: 191 |
|
|
| 10 Sep 2014 09:44 AM |
| then where did you get the "OnClicked" error |
|
|
| Report Abuse |
|
|
hawk2eye
|
  |
| Joined: 03 May 2010 |
| Total Posts: 8525 |
|
|
| 10 Sep 2014 09:48 AM |
| well it wont work so > error |
|
|
| Report Abuse |
|
|
hawk2eye
|
  |
| Joined: 03 May 2010 |
| Total Posts: 8525 |
|
| |
|
|
| 10 Sep 2014 09:58 AM |
script.Parent.Clicked:connect(OnClicked)
It is script.Parent.Button.MouseButton1Down:connect(OnClicked) (assuming script is in Surface GUI instance and not in the button |
|
|
| Report Abuse |
|
|
| |
|
hawk2eye
|
  |
| Joined: 03 May 2010 |
| Total Posts: 8525 |
|
|
| 10 Sep 2014 10:01 AM |
the script IS in the surface gui e.e
will it still work if its not in the gui button |
|
|
| Report Abuse |
|
|
hawk2eye
|
  |
| Joined: 03 May 2010 |
| Total Posts: 8525 |
|
|
| 10 Sep 2014 10:05 AM |
| I've put, the surface gui in a brick, a textbutton in the surface gui and the script in the textbutton and it doesnt work qq |
|
|
| Report Abuse |
|
|
hawk2eye
|
  |
| Joined: 03 May 2010 |
| Total Posts: 8525 |
|
| |
|