Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to i make this script begin in MouseButton1Click?

script.Parent.MouseButton1Click:connect (function ()

playername = script.Parent.Parent.Parent.Parent.Parent.Parent.Name

player = Workspace:FindFirstChild(playername)

if player.player ~= nil then

local player.player = script.Parent

local humanoid = Player.Player:WaitForChild("Humanoid")

-- Create the Accessory.

local clockworksShades = Instance.new("Accessory")

clockworksShades.Name = "ClockworksShades"

local handle = Instance.new("Part")

handle.Name = "Handle"

handle.Size = Vector3.new(1,1.6,1)

handle.Parent = clockworksShades

local faceFrontAttachment = Instance.new("Attachment")

faceFrontAttachment.Name = "FaceFrontAttachment"

faceFrontAttachment.Position = Vector3.new(0,-0.24,-0.45)

faceFrontAttachment.Parent = handle

local mesh = Instance.new("SpecialMesh")

mesh.Name = "Mesh"

mesh.Scale = Vector3.new(1,1.3,1)

mesh.MeshId = "rbxassetid://1577360"

mesh.TextureId = "rbxassetid://1577349"

mesh.Parent = handle

-- Attach the Accessory to the humanoid.

humanoid:AddAccessory(clockworksShades)

end

end)

5 comments

0

You first need to tell us if it's a script inside a gui, if it's local or not and if it's not in a gui where is it.

0

It's not a local script, and it's a TextButton

0

You have loads of syntax errors in your code which will prevent it to run. The code will run in your event in theory, however, the code will not compile.

0

And it's inside screengui-frame-Textbutton

0

i need a fix to this script, please.

1 answer

Change (""…playername…"") - (playername). You don't need "" and ... if you're not adding anything inside the "".

change all "playerModel" to "player". "player" is already the model.

3 comments

0

again error(got .) in 7

0

what to do?

0

I edit the script, check it

This discussion is preserved as it was. New answers, comments, and votes are closed.