Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How would I make this script not kill the player?

Asked by 5 years ago

I am making a flash like script so when you press F it tpes the player to the direction of the mouse

script():

local Flash = Instance.new("RemoteEvent")
Flash.Name = "FlashService"
Flash.Parent = game.ReplicatedStorage

local function FlashAtEm(plr)
local mouse = plr:GetMouse()
local Char = plr.Character
local Hooman = Char.Humanoid
Char.UpperTorso.Position = mouse.Hit.p
end
Flash.OnServerEvent:Connect(FlashAtEm)

localscript():

local UIS = game:GetService("UserInputService")
local Remote = game.ReplicatedStorage:FindFirstChild("FlashService")
UIS.InputBegan:Connect(function(input)
 if input.KeyCode == Enum.KeyCode.F then
    Remote:FireServer()
 end
end)
0
Moving the torso kills the player instantly, try using another body part or the entire player model. Ap_inity 112 — 5y
0
It says Position, CFrame aren't a valid member of Model mixgingengerina10 223 — 5y
0
Use :SetPrimaryPartCFrame() instead to move completely player model. AswormeDorijan111 531 — 5y
0
Here, I'll write an example AswormeDorijan111 531 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

Just change the "Normal" Script not Local.

al Flash = Instance.new("RemoteEvent")
Flash.Name = "FlashService"
Flash.Parent = game.ReplicatedStorage

local function FlashAtEm(plr)
local mouse = plr:GetMouse()
local Char = plr.Character
local Hooman = Char.Humanoid
Char:SetPrimaryPartCFrame(CFrame.new(mouse.Hit.p))
end
Flash.OnServerEvent:Connect(FlashAtEm)

-- Hope this works

0
Thanks! mixgingengerina10 223 — 5y
0
You're welcome and good luck with ur games! AswormeDorijan111 531 — 5y
0
This will not work. The Mouse cannot be obtained by the server. User#19524 175 — 5y
Ad

Answer this question