The script works fine in studio but once I test it using servers nothing happens when the textbutton is clicked, I don't know what's wrong with it, could anyone take a quick look for me?

local player = script.Parent.Parent.Parent

Back = script.Parent.Previous
Next = script.Parent.Next
hatfolder = game:GetService("ReplicatedStorage").Hats
hair1 = hatfolder["LongHairHeadBand Black"]
hair2 = hatfolder["Katrina"]
hair3 = hatfolder["Tail"]
hair4 = hatfolder["Bun"]
hair5 = hatfolder["Ultra-Fabulous Hair"]
hair6 = hatfolder["BrownCharmerHair"]
hair7 = hatfolder["ShortSpiky"]
hair8 = hatfolder["Swoosh"]
hair9 = hatfolder["anima"]
hair10 = hatfolder["bdh"]
dummy = game.Workspace.P
local hair = 1

Back.MouseButton1Down:connect(function()
	if hair == 2 then
		dummy.Hair:destroy()
		hair1:clone()
		hair1:clone().Name = "Hair"
		hair1:clone().Parent = dummy
		dummy["LongHairHeadBand Black"].Name = "Hair"
		hair = 1
		print(hair)
end
end

Next.MouseButton1Down:connect(function()
	if hair == 1 then
		dummy.Hair:destroy()
		hair2:clone()
		hair2:clone().Parent = dummy
		dummy["Katrina"].Name = "Hair"
		hair = 2
		print(hair)
end
end)

2 comments

0

Use local player = game.Players.LocalPlayer see if it helps

0

No luck, player isn't used anywhere else at the moment, just in-case I need to grab the name.