|
| 30 Nov 2014 11:15 PM |
why this not working?
sp = script.Parent pla = game.Players.LocalPlayer char = pla.Character
sp.MouseButton1Click:connect() char.Head.BrickColor = BrickColor.new("Reddish brown") wait() |
|
|
| Report Abuse |
|
|
| |
|
|
| 30 Nov 2014 11:23 PM |
Because you are not connecting a function to the click event. A function to be called when the event occurs needs to be placed between the (). In this case you can just wait until the event happens once, instead of calling a function every time it happens. This is done like so:
local parent = script.Parent local player = game:GetService("Players").LocalPlayer local char = player.Character or player.CharacterAdded:wait()
parent.MouseButton1Click:wait() char.Head.BrickColor = BrickColor.new("Reddish brown") |
|
|
| Report Abuse |
|
|
|
| 30 Nov 2014 11:25 PM |
| :D work thank you darknightofVorhan |
|
|
| Report Abuse |
|
|
| |
|
|
| 30 Nov 2014 11:38 PM |
If you want it to happen more than once then use this:
local parent = script.Parent local player = game:GetService("Players").LocalPlayer local char = player.Character or player.CharacterAdded:wait()
local function onClick() char.Head.BrickColor = BrickColor.new("Reddish brown") end
parent.MouseButton1Click:connect(onClick) |
|
|
| Report Abuse |
|
|
|
| 01 Dec 2014 12:23 AM |
Better yet save space and make it an anonymous function, since you probably won't call it again.
local parent = script.Parent local player = game:GetService("Players").LocalPlayer local char = player.Character or player.CharacterAdded:wait()
parent.MouseButton1Click:connect(function() char.Head.BrickColor = BrickColor.new("Reddish brown") end)
-The [Guy] |
|
|
| Report Abuse |
|
|