Let's see if this works... I've seen many people saying that you need to use events, but for a beginning scripter, I wouldn't expect you to understand events. Heck, I don't even understand events yet! So I just do a little local value changing here and a little checking for changes there, and that's all that's needed!
So, let's try a something a bit like this:
To set things up, you need a StringValue in ReplicatedStorage named "PlrName"
In the Client-Side (local, in the Button):
plr = game.Players.LocalPlayer
script.Parent.MouseButton1Click:Connect(function()
game:GetService("ReplicatedStorage"):FindFirstChild("PlrName").Value = plr.Name
end)
In the Server-Side (plain, in ServerScriptService):
local plrNameV = game:GetService("ReplicatedStorage"):FindFirstChild("PlrName")
plrNameV:GetPropertyChangedSignal("Value"):Connect(function()
local plr = game.Players:FindFirstChild(plrNameV.Value)
local Pos = plr.Character:GetPrimaryPartCFrame()
plr:LoadCharacter()
plr.Character:SetPrimaryPartCFrame(Pos)
if plr.Character:FindFirstChild("ForceField") then
plr.Character:FindFirstChild("ForceField):Destroy() -- Your Remove Forcefield module
end
end)
2 comments
LoadCharacter cannot be called through a LocalScript. You would need to use RemoteEvents to achieve this. You have no errors because you are wrapping the function in a pcall.
don't forget to accept my answer if it helps.