Should i be using serverscripts for this?

hi there, i am working on a bloody pvp game, however, i want to know if i should be using serverscripts or localscripts for my gui?
what the hell is wrong with me
heres the code:

Arena
script.Parent.MouseButton1Click:Connect(function()
	script.Parent.Parent.Parent.Parent.Character:PivotTo(workspace.Arena.CFrame + Vector3.new(0, 15, 0))
end)
Ways To Die
script.Parent.MouseButton1Click:Connect(function()
	script.Parent.Parent.Parent.Parent.Character:PivotTo(workspace.Baseplate.CFrame + Vector3.new(0, 15, 0))
end)
2 Likes

I have used scripts for buttons before a long time ago but thinking about using Scripts instead of LocalScripts for GUI buttons now doesn’t seem like a good practice.

In order to reach the Player and the Player.Character you will have to create a variable that uses multiple ".Parent"s in a variable. It’s something like “local plr = script.Parent.Parent.Parent.Parent.Parent.Parent.Parent” etc and etc. Coding something like this seems pretty messy. I’d suggest using LocalScript.

1 Like

I would suggest just using a local script makes it more organized and you can keep the same functions, if anything just send a remote to the server to change the characters position if you run into issues, seems kinda pointless. but local scripts you can reference the player easier so

always use local scripts for guis, there is no reason to use server scripts

if you need to do something on the server then send a message through a remote event

well it works atleast.

Yes it will work, but i suggest using a remote event, as @happya_x said, GUIs communicating should be local scripts. Then communicate to the server with a remote event. It’s just good practice and there is probably something with performance too, i don’t know i never looked into why we use local scripts for client gui’s.

i think it was because they used to not work with guis. apparently roblox has changed this however.

1 Like