Good Day Everyone, I’m having a small problem with my script and wondering if someone can help me. I’m making a telekinesis script, and when you press “t” the character is picked up, and when you click again in the direction of the mouse the player is moved to that part.
The issue is on a regular dummy, the lifting is the perfect height but on a character, the lifting is lower which I guess has to do with weight. As well as, it lifts but it doesn’t throw, it just drops it back down (the first time). The second time it lifts but it just stays in the air and doesn’t even drop AT ALL.
Starter Character (drops but doesn’t throw/first attempt)
https://gyazo.com/f33290d2e8b515056f53caa2c6570244
Regular Character (lifts higher, doesn’t drop, doesn’t throw/second attempt)
https://gyazo.com/c1098c9f75db70cd718436b202dbc595
I’ve tried looking for solutions and referring to my scripting buddies but I’ve tried what they said and it still doesn’t work on the throwing half. There are no output errors so I’m guessing there might be something wrong with my if statements.
Here are my scripts:
My Local Script
local plr = game:GetService('Players').LocalPlayer
local replicatedstorage = game:GetService('ReplicatedStorage')
local Mouse = plr:GetMouse()
local Radius = 10
local AllowTele = false
local Debounce = false
Mouse.KeyDown:Connect(function(key)
local Key = key:lower()
if key == "t" then
AllowTele = true
local humanoid = Mouse.Target.Parent:FindFirstChild('Humanoid')
if humanoid then
replicatedstorage:FindFirstChild('TeleGrab'):FireServer(humanoid,3559477198)
Mouse.Button1Down:Connect(function()
if AllowTele and not Debounce then
AllowTele = false
local hit = Mouse.hit
replicatedstorage:FindFirstChild('TeleThrow'):FireServer(hit)
Debounce = true
wait(6)
Debounce = false
end
end)
end
end
end)
My Server Script
game:GetService('ReplicatedStorage'):FindFirstChild("TeleGrab").OnServerEvent:Connect(function(Player,hum,animationID)
local Radius = 6
if (Player.Character:FindFirstChild("HumanoidRootPart").Position - hum.Parent:FindFirstChild("HumanoidRootPart").Position).magnitude <= Radius then
local InAir = Instance.new('BoolValue')
InAir.Value = true
InAir.Name = "InAir"
InAir.Parent = hum.Parent
local animation = Instance.new("Animation")
animation.AnimationId = "http://www.roblox.com/Asset?ID="..animationID
local loadedAnimation = game.Workspace[Player.Name].Humanoid:LoadAnimation(animation)
loadedAnimation:Play()
local bodyposition = Instance.new('BodyPosition')
bodyposition.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
bodyposition.P = 200
bodyposition.D = 100
bodyposition.Parent = hum.Parent:FindFirstChild("HumanoidRootPart")
bodyposition.Position = Player.Character.UpperTorso.CFrame:pointToWorldSpace(Vector3.new(0,6,-3))
wait(3)
loadedAnimation:Stop()
loadedAnimation:Destroy()
game:GetService('ReplicatedStorage'):FindFirstChild('TeleThrow').OnServerEvent:Connect(function(Player,hit)
bodyposition.Position = Player.Character.Head.Position + (hit.p - Player.Character.Head.Position).unit * 65
hum:TakeDamage(1)
bodyposition:Destroy()
hum.Parent:FindFirstChild('InAir'):Destroy()
end)
end
end)