When using remote events should the check that checks if the player can perform the action be in the server script or local script?
workspace.Part.Touched:Connect(function(hit) if hit.Parent.Name == "Part" then print("A") game.ReplicatedStorage.RemoteEvent:FireServer() end end)
Should this be in the local script with fire server or a server script with onserverevent? Which is the most safest for no exploiters?
Touched
event on the client. If you really wanted to fire something with server scripts and server scripts only, use a BindableEvent
. These are for server-to-server communication or for client-to-client communication. These are not to make your game FE compatible.local bindable = game.Workspace.Event local part = game.Workspace.Part local plrs = game:GetService"Players" function getPlayerFromChar(char) if plrs:GetPlayerFromCharacter(char) then return plrs:GetPlayerFromCharacter(char) end end bindable.Event:Connect(function() -- code end) part.Touched:Connect(function(part2) if getPlayerFromChar(part2.Parent) then local plr = getPlayerFromChar(part2.Parent) if plr then bindable:Fire() end end end)