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

Why is my keybind magic fling script not working on other models?

Asked by 3 years ago
Edited 3 years ago

I have this script here when you 'press e' it's supposed to fling the other person but all it does is fling me. Any help with changing it so it flings the other models instead of flinging me

game.Players.LocalPlayer:GetMouse().KeyDown:Connect(function(key)
    if key == "e" then
        local char=script.Parent
        local humanoid=char.Humanoid
        local torso=char.HumanoidRootPart
        --------------
        --------------
        wait()

        humanoid.PlatformStand=true
        torso.CFrame=torso.CFrame*CFrame.new(0,0.2,0)*CFrame.Angles(-.5,0,math.random(0,0))
        torso.Velocity=torso.CFrame.lookVector*-100
        wait(1)
        humanoid.PlatformStand=false

        wait()
    end
end)
0
Idk what else to do, but maybe anchor the flinger's character for that one second? Don't anchor the other person of course. Voltaicmimic 43 — 3y

1 answer

Log in to vote
0
Answered by
Xapelize 2658 Moderation Voter Community Moderator
3 years ago

You located yourself as the flinger. Consider changing line 3: local char = game.Workspace:WaitForChild("PlayerName")

Ad

Answer this question