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

Set humanoid walkspeed x jumppower to 0 not functioning?

Asked by 5 years ago

I am creating handcuffs and they should set a player's humanoid.WalkSpeed and humanoid.JumpPower to 0, the script won't work. The only thing that works is the ArrestEvent. Please help!

LocalScript

--// Variables
local Player = game.Players.LocalPlayer
local Instances = script.Parent.Resource.Instances
local CaptureEvent = game.ReplicatedStorage.Remotes.Capture
local ArrestEvent = game.ReplicatedStorage.Remotes.Arrest
local ReleaseEvent = game.ReplicatedStorage.Remotes.Release
local UI = Instances.UI.ArrestGUI
local Tool = script.Parent
local Prefix = "http://www.roblox.com/Thumbs/Avatar.ashx?x=150&y=150&Format=Png&username="
--// Functions
Tool.Equipped:Connect(function(Mouse)
    Mouse.Button1Down:Connect(function()
        if Mouse.Target and Mouse.Target then
            local Target = Mouse.Target.Parent
            print(Target)
            for _,v in pairs(game.Players:GetPlayers()) do
                if Target.Name == v.Name then
                    CaptureEvent:FireServer(Target.Name)
                    if Player.PlayerGui:FindFirstChild("ArrestGUI") then
                        return
                    else
                        --// Variables
                        local Clone = UI:Clone()
                        repeat wait() until Clone.MainFrame
                        local Title = Clone.MainFrame:WaitForChild("Title")
                        local ViewFrame = Clone.MainFrame:WaitForChild("View")
                        local Picture = ViewFrame.Player
                        Title.Text = "Detained - "..Target.Name
                        Picture.Image = Prefix..Target.Name
                        Clone.MainFrame.Active = true
                        Clone.MainFrame.Selectable = true
                        Clone.MainFrame.Draggable = true
                        wait()
                        Clone.Parent = Player.PlayerGui
                        --// Functions
                        ViewFrame.Arrest.MouseButton1Click:Connect(function()
                            local target = game.Players:FindFirstChild(Target.Name)
                            ArrestEvent:FireServer(target)
                        end)
                        ViewFrame.Release.MouseButton1Click:Connect(function()
                            local target = game.Players:FindFirstChild(Target.Name)
                            ReleaseEvent:FireServer(target)
                        end)
                        Clone.MainFrame.Close.MouseButton1Click:Connect(function()
                            Clone:Destroy()
                        end)
                    end
                end
            end
        end
    end)
end)

Script: - Arrest Event Working -

--// Variables
local ArrestEvent = game.ReplicatedStorage.Remotes.Arrest
local ReleaseEvent = game.ReplicatedStorage.Remotes.Release
local CaptureEvent = game.ReplicatedStorage.Remotes.Capture
--// Asset Warmup
repeat wait() until ArrestEvent
repeat wait() until ReleaseEvent
repeat wait() until CaptureEvent
--// Functions
ArrestEvent.OnServerEvent:Connect(function(Player, Target)
    if Target.Character then
        local Character = Target.Character
        if Character.Humanoid then
            local Humanoid = Character.Humanoid
            Target.TeamColor = BrickColor.new("Really black")
            Humanoid.Health = 0
        end
    end
end)
ReleaseEvent.OnServerEvent:Connect(function(Player, Target) -- Broken
    if Target.Character then
        local Character = Target.Character
        if Character.Humanoid then
            local Humanoid = Character.Humanoid
            Humanoid.JumpPower = 50
            Humanoid.WalkSpeed = 16
        end
    end
end)
CaptureEvent.OnServerEvent:Connect(function(Player, Target) -- Broken
    if Target.Character then
        local Character = Target.Character
        if Character.Humanoid then
            local Humanoid = Character.Humanoid
            Humanoid.JumpPower = 0
            Humanoid.WalkSpeed = 0
        end
    end
end)
0
I can only see one thing here from the start and it is that humanoid is not a boolean. SteamG00B 1633 — 5y
0
That is not the problem. I put in prints to see if everything worked and it did. Except the fact that it didn't change the humanoid state. namespace25 594 — 5y
0
Why do you do `repeat wait() until x` on lines 6, 7, and 8 in the second script? Optikk 499 — 5y
0
Cause I want. namespace25 594 — 5y
0
On line 34 in the second script, change it to, 'local Humanoid = Target:FindFirstChild("Humanoid")' or 'local Humanoid = Character:FindFirstChild("Humanoid")' TheOnlySmarts 233 — 5y

Answer this question