Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

When I click the button, nothing happens, why?

Asked by 7 years ago
local Player = game.Players.LocalPlayer
local gender = game.ServerStorage[Player.Name].Gender.Value
local playerhair = game.ServerStorage[Player.Name].Hair.Value
local hairs = game.ServerStorage.Hairs
local buttonright = script.Parent[">"]
local buttonleft = script.Parent["<"]

function onClickRight()
if playerhair == 0 then
if gender == "Male" then
playerhair = 1
local malehair1 = hairs.MaleHair1:Clone()
malehair1.Parent = Player.Character
local w = Instance.new("Weld")
w.Part0 = Player.Character.Head
w.Part1 = malehair1
w.Parent = malehair1
w.C0 = CFrame.new(0, 0, 0.25)*CFrame.Angles(0, 0, 0)
end
--female hairs
if gender == "Female" then
local femalehair1 = hairs.FemaleHair1:Clone()
femalehair1.Parent = Player.Character
local w = Instance.new("Weld")
w.Part0 = Player.Character.Head
w.Part1 = femalehair1
w.Parent = femalehair1
w.C0 = CFrame.new(0, 0, 0)*CFrame.Angles(0, 0, 0)
end
end
end

buttonright.MouseButton1Click:connect(onClickRight)

function onClickLeft()
--malehairs
if playerhair == 1 then
if gender == "Male" then
playerhair = 0
Player.Character.MaleHair1:Destroy()
end
--femalehairs
if gender == "Female" then
playerhair = 0
Player.Character.FemaleHair1:Destroy()
end
end
end

buttonleft.MouseButton1Click:connect(onClickLeft)

It is not working but I get no error in the output either, help please?

0
1st you are trying to access ServerStorage from a localscript? http://wiki.roblox.com/index.php?title=API:Class/ServerStorage User#5423 17 — 7y
0
ohh thanks AdamFunMaker 35 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago

You must be trying to access ServerStorage. You can't do that, I think.

API:Class/ServerStorage

Ad

Answer this question