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

Why doesnt the hat show up on remote event fire (FE problem)?

Asked by 7 years ago

I'm trying to make a character creator GUI, but when i click the buttons, it clones and works fine on studio, but doesn't work on real game.'

no errors show up on output

i tried scripting it using a local script only but that gave the same results

Local script

local player = game.Players.LocalPlayer

local dummy = game.Workspace.CurrentCamera:WaitForChild(player.Name..'-'..'Dummy' )

local maleHairs1 = game:GetService('ReplicatedStorage'):WaitForChild('CharacterCreationItems'):WaitForChild'MaleHair'

local gender = script.Parent.Parent:WaitForChild('CaCScreen'):WaitForChild'Frame':WaitForChild'Selections':WaitForChild'Gender'

local currentHairValue = script.Parent.Parent:WaitForChild('CaCScreen'):WaitForChild'Frame':WaitForChild'Selections':WaitForChild'MaleHair1'

local leftHairButton =script.Parent.Parent:WaitForChild('CaCScreen'):WaitForChild'Frame':WaitForChild'Buttons':WaitForChild'HairLeft'
local rightHairButton = script.Parent.Parent:WaitForChild('CaCScreen'):WaitForChild'Frame':WaitForChild'Buttons':WaitForChild'HairRight'


local remote = game:GetService('ReplicatedStorage'):WaitForChild('Remotes'):WaitForChild'ChangeMaleHair1'


local function leftDown()
    if  gender.Value ==1 then 
    currentHairValue.Value = currentHairValue.Value -1

    end
end


local function rightDown()
    if  gender.Value ==1 then 
    currentHairValue.Value = currentHairValue.Value +1

    end
end




currentHairValue.Changed:connect(function()



    remote:FireServer({dummy, currentHairValue,maleHairs1})


end)





leftHairButton.MouseButton1Down:connect(leftDown)
rightHairButton.MouseButton1Down:connect(rightDown)



Server script

local change = Instance.new('RemoteEvent')
local rep = game:GetService('ReplicatedStorage')
change.Name = 'ChangeMaleHair1'
change.Parent = rep:WaitForChild'Remotes'


change.OnServerEvent:connect(function(player, arguments)


            local dummy = arguments[1]

            local currentHairValue = arguments[2]
            local maleHairs = arguments[3]
            local hairClone =  maleHairs['Hair'..currentHairValue.Value]:Clone()
            print(hairClone.Name)
            hairClone.Parent = dummy


end)

Answer this question