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

How to make local scripts change BoolValue?

Asked by 5 years ago

I'm wondering how can I make a local script change the BoolValue and have the server read it. Currently I have this Crouching script that works playing the animation to everyone else, however the value stay the same (false). How do I fix this?

Player = game.Players.LocalPlayer
repeat
    wait()
until Player.Character
Mouser = Player:GetMouse()
name = Player.Name
char = game.Workspace[Player.Name]
Animation = script.Anim

animtrack = char.Humanoid:LoadAnimation(Animation)


Mouser.KeyDown:connect(function(key)
    if string.byte(key) == 48 then
        animtrack:Play()
        Player:FindFirstChild("Crouch").Value = true
        char.Humanoid.WalkSpeed = 8
            end
        end)

    Mouser.KeyUp:connect(function(key)

     if string.byte(key) == 48  then
        script.Disabled = true
        animtrack:Stop()
        Player:FindFirstChild("Crouch").Value = false
        char.Humanoid.WalkSpeed = 16
        script.Disabled = false 
    end
end)
0
also, use UserInputService.InputBegan instead of Mouse.KeyDown theking48989987 2147 — 5y

1 answer

Log in to vote
0
Answered by
Nuqz 0
5 years ago

You can't change the server directly using a local script. You can only change it by using remote events and remote functions due to filtering enabled.

Hoped this helped!

Ad

Answer this question