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

How to change every players in the server change walkspeed and jumppower except a specific player?

Asked by 3 years ago
Edited 3 years ago

Hi im trying to make a script where a specific player can click a gui button (me) and itll freeze everyone (specifically making me sing and making them sleep) ive tried 2 methods and didnt work this took me 3 days trying to figure this out heres the script

local YuiiGui = game.Players.YuiiIsOld.PlayerGui
local Yuii = game.Workspace.YuiiIsOld
local Everyone = script.Parent
local SleepEvent = game.Workspace.SleepEvent
local FreezeEvent = game.Workspace.FreezeEvent
local StartFreeze = script.Parent.FreezeHandler
local YuiiHum = game.Workspace.YuiiIsOld.Humanoid
YuiiGui.YuiiIsOld.Frame.Sing.MouseButton1Click:Connect(function()
    YuiiGui.YuiiIsOld.Frame.Visible = false
    print("Singing!")
    script.Lullaby:Play()
    Yuii.Sing.Disabled = false
    Yuii.Animate.Disabled = true
    FreezeEvent:Play()
    StartFreeze.Disabled = false
    wait(8)
    YuiiGui.YuiiIsOld.Frame.Sing.Visible = false
    YuiiGui.YuiiIsOld.Frame.Visible = true
        script.Lullaby:Stop()
        Yuii.Sleep.Disabled = true
        Yuii.Animate.Disabled = false
        Yuii.Sing.Disabled = true
        YuiiHum.WalkSpeed = 16
    YuiiHum.JumpPower = 50
    Everyone.Sleep.Disabled = false
    Everyone.Animate.Disabled = true
    wait(5)
    Everyone.Sleep.Disabled = true
    Everyone.Animate.Disabled = false
    Everyone.FreezeHandler.Disabled = true
    Everyone.FreezeHandler:Clone()
    Everyone.FreezeHandler:Destroy()
    wait(1)
    YuiiGui.YuiiIsOld.Frame.Sing.Visible = true
end)

this is inside a local script located at StarterCharacterScripts the other script named FreezeHandler has this

    if game.Workspace.FreezeEvent.Playing == true then 
        print("Successfully Frozen")
        script.Parent.Humanoid.WalkSpeed = 0
        script.Parent.Humanoid.JumpPower = 0
    elseif game.Workspace.FreezeEvent.Playing == false then
        script.Parent.Humanoid.WalkSpeed = 16
        script.Parent.Humanoid.JumpPower = 50
    end

the animation works dont worry, the walkspeed however wont change nor the jumppower

2 answers

Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

Assuming, that the code you have mentioned in LocalScript is that only, it might execute once when the player's Character is loaded.

In order to fix that, you can add a while loop to check the values constantly.

while wait() do -- Loops the code 33 times a second (in order to check constantly)
    if game.Workspace.FreezeEvent.Playing == true then 
        print("Successfully Frozen")
        script.Parent.Humanoid.WalkSpeed = 0
        script.Parent.Humanoid.JumpPower = 0
    elseif game.Workspace.FreezeEvent.Playing == false then
        script.Parent.Humanoid.WalkSpeed = 16
        script.Parent.Humanoid.JumpPower = 50
    end
end

Lemme know if it helps!

0
I already tried this method, except with while wait() do its while true do, it did not work YuiiIsOld 13 — 3y
0
*It still doesnt work with while wait() do either way YuiiIsOld 13 — 3y
0
Just check whether the value of Playing is changing BestCreativeBoy 1395 — 3y
0
If it is, then try using game.Players.LocalPlayer.Character.Humanoid.WalkSpeed and all BestCreativeBoy 1395 — 3y
0
Yeah that was the thing i got wrong thank you YuiiIsOld 13 — 3y
Ad
Log in to vote
0
Answered by 3 years ago

Nvm i already fixed it i just needed to fix the humanoid part

Answer this question