I'm coding it where a keyboard input would cause a fire to a server script, creating sort of a forcefield surrounding the player by using cframes and welding. However, it appears that there is a delay because I would be teleported a few steps back when the forcefield appears.
Does anyone know how to fix this?
Local Script
UIS.InputBegan:Connect(function(input, isTyping)
if isTyping then
return
elseif input.KeyCode == Enum.KeyCode.F then
if debounce == false and isBroken.Value == false then
if isActive == false then
ended = false
isActive = true
Block:FireServer(isActive)
end
end
end
end)
Server Script
local blockfield = Meshes:WaitForChild("BlockField"):Clone()
blockfield.CFrame = hrp.CFrame
blockfield.Parent = Character
local weld = Instance.new("ManualWeld")
weld.Part0 = blockfield
weld.Part1 = hrp
weld.C0 = weld.Part0.CFrame:toObjectSpace(weld.Part1.CFrame)
weld.Parent = weld.Part0
