So say I click something and I want it to insert a Shirt and pants into that character would I do
Function onClicked()
local S = Instance.new("Shirt")
S.Parent = hit.Parent -- part I need help on
end
So say I click something and I want it to insert a Shirt and pants into that character would I do
Function onClicked()
local S = Instance.new("Shirt")
S.Parent = hit.Parent -- part I need help on
end
You never justified what hit was. If you want to use this you would first have to declare the variable hit.
function onClicked(hit) -- See that hit in there? That variable tells the script who clicked it.
local S = Instance.new("Shirt")
S.Parent = hit.Parent
end
The variable doesn't have to be hit either, you could make it clicked, player, afuaguf, or anything else at all.
If you are talking about the event MouseClick then you need a connection line so it can be activated by the player who activates it.which then connects the function for example: Be aware the MouseClick event can only be activated by using the object ClickDetector so put it in the brickthat will be used for clicking.
function Clicker()
local Part=Workspace.Part
Part:Destroy()
end
script.Parent.ClickDetector.MouseClick:connect(Clicker)
Put it in the brick at bottom put..Actually here
function onClicked()
local S = Instance.new("Shirt")
S.Parent = hit.Parent -- part I need help on
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
That should work tell me Remember! Put a ClickDetector in the brick.
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
You didn't write the function between the arguments in the method at the connection line.