Basic Coding Requesting Help

First of all I’m not a coder

Wondering how could you make this only affectable for client and not serverside

game.Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(char)
		local ProximityPrompt = script.Parent

		ProximityPrompt.Triggered:Connect(function(player)
			char:MoveTo(workspace.teste.Position)
		end)
	end)		
end)

just remove the playeradded function and make a plr variable. Like this:

local plr = game.Players.LocalPlayer
plr.CharacterAdded:Connect(function(char)
	local ProximityPrompt = script.Parent
	
	ProximityPrompt.Triggered:Connect(function(player)
		char:MoveTo(workspace.teste.Position)
	end)
end)

You can use a remote or just put the proximity prompt code inside a LocalScript, but I don’t know if it will work.

A local script is client sided and will only happen to the player, and a server-sided script will happen to all the players.

An easier and better way would be to just move the whole script to a local script instead, since GUIs like proximity prompts should be used in a local script :slight_smile:

Like so:

local player = game.Players.LocalPlayer
player.CharacterAdded:Connect(function(char)
	local ProximityPrompt = game.Workspace.Part.ProximityPrompt
	
	ProximityPrompt.Triggered:Connect(function(player)
		char:MoveTo(workspace.teste.Position)
	end)
end)

Make sure to put your local script either in StarterPlayerScripts, or StarterGui since local scripts don’t work in the workspace :slight_smile: