Event wont fire in server script

That means playerGUI does not exist. To fix it you can add a :WaitForChild("PlayerGui") when using playergui.

Also if you wont mind can you give us the entire code your using? So we can understand what your trying to really achieve here.

nevermind it works!! thanks you very much.

No Problem! Glad I was able to help you.

Oh i have another problem if you dont mind, here is the local script :

game.ReplicatedStorage.events.guistopngo.OnClientEvent:Connect(function()
	local plr = game.Players.LocalPlayer
	print("ehe")
	plr:WaitForChild("PlayerGui").rules.Enabled = true
	plr:WaitForChild("PlayerGui").rules.smily.woosh:Play()
	plr:WaitForChild("PlayerGui").rules.smily.appear:Play()
	plr:WaitForChild("PlayerGui").rules.smily.Position = UDim2.new(1.349, 0,0.158, 0)
	plr:WaitForChild("PlayerGui").rules.smily:TweenPosition(UDim2.new(1.349, 0,0.158, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 3)
	wait(1)
	plr:WaitForChild("PlayerGui").rules.smily.ViewportFrame.smily.laugh:FireServer()
	wait(4)
	plr:WaitForChild("PlayerGui").rules.smily:TweenPosition(UDim2.new(1.349, 0,0.158, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 4)
	wait(4)
	plr:WaitForChild("PlayerGui").rules.Enabled = false
end)



the tween doesnt play and i cant see the frame.

May I ask where the local script is?

the script is located in starter gui

To be exact where? Is it possible to put it in the “rules” screengui?

hmm sure i’ll try it! thanks for the tip

no it still doesnt tween it, maybe its linked to

plr:WaitForChild("PlayerGui").rules.smily:TweenPosition(UDim2.new(1.349, 0,0.158, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 3)

No problem and after that:

local rules = script.Parent -- Assuming the script is parented to the screengui
game.ReplicatedStorage.events.guistopngo.OnClientEvent:Connect(function()
	local plr = game.Players.LocalPlayer
	print("ehe")
	rules.Enabled = true
	rules.smily.woosh:Play()
	rules.smily.appear:Play()
	rules.smily.Position = UDim2.new(1.349, 0,0.158, 0)
	rules.smily:TweenPosition(UDim2.new(1.349, 0,0.158, 0), "Out", "Quad", 3)
	wait(1)
	rules.smily.ViewportFrame.smily.laugh:FireServer()
	wait(4)
	rules.smily:TweenPosition(UDim2.new(1.349, 0,0.158, 0), "Out", "Quad", 4)
	wait(4)
	plr:WaitForChild("PlayerGui").rules.Enabled = false
end)

Also the twween is not playing because…

rules.smily:TweenPosition(UDim2.new(1.349, 0,0.158, 0), "Out", "Quad", 4)

…and this…

rules.smily.Position = UDim2.new(1.349, 0,0.158, 0)
rules.smily:TweenPosition(UDim2.new(1.349, 0,0.158, 0), "Out", "Quad", 3)

…are the same and therefore no use, and also your setting the position to the same as the position in the tween therefore its not tweening.

Ohhh my bad i forgot to change it!!

it works now, thanks you again very much!!

1 Like

No problem. Glad your problem is solved.

3 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.