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

How do you take away a players control?

Asked by 8 years ago

I'm trying to take away a players control so that it isn't able to move I check wiki but I have trouble with tables.Any videos or website,anything that can help me?. I tried to anchor the player Torso but its invalid or something. Any help?

local Code = script.Parent.Parent.Parent.Password.Code
local player = game.Players.LocalPlayer
local wrongs = 0
local Control = game.Players.LocalPlayer.PlayerScripts.ControlScript.Disabled

Control = true
function C()
if Code.Text == "2593316" then 
    wait(.1)
    Control = false
    wait(.1)
    player.PlayerGui.EntryGui.ENTER.TextButton.TextTransparency = 1
    wait(.1)
    Code.TextTransparency = 1
    wait(.1)
    Code.TextStrokeTransparency = 1
    wait(.1)
    player.PlayerGui.EntryGui.Black.Visible = false
    wait(.1)
else
    if wrongs == 0 then
    player.PlayerGui.EntryGui.Wrong1.Visible = true
wait(.5)
    player.PlayerGui.EntryGui.Wrong1.Visible = false
        wrongs = wrongs+1
     wait(.1)
    elseif wrongs == 1 then
    player.PlayerGui.EntryGui.Wrong1.Visible = false
    player.PlayerGui.EntryGui.Wrong2.Visible = true
wait(.5)
    player.PlayerGui.EntryGui.Wrong2.Visible = false
    wrongs = wrongs+1
     wait(.1)
    elseif wrongs == 2 then
    wrongs = wrongs+1
    player.PlayerGui.EntryGui.Wrong1.Visible = false
    player.PlayerGui.EntryGui.Wrong2.Visible = false
    player.PlayerGui.EntryGui.Wrong3.Visible = true
wait(.5)
    player.PlayerGui.EntryGui.Wrong3.Visible = false
wait(1)
    player.PlayerGui.EntryGui.Wrong1.Visible = true
wait(.1)
    player.PlayerGui.EntryGui.Wrong2.Visible = true
wait(.1)
    player.PlayerGui.EntryGui.Wrong3.Visible = true
wait(2)
    player:Kick()
        end
    end
end
script.Parent.MouseButton1Click:connect(C)



This is what the output said.Some of it is my plugins. 15:38:28.581 - Auto-Saving... Loaded gloo library. Type _G.gloo.Help() for help. 15:38:29.353 - ItemButton is not a valid member of Script 15:38:29.354 - Script 'Plugin_321426830.KinqStudioDailyAwardPlugin', Line 49 15:38:29.354 - Stack End Loading Cutscene Editor... 15:38:29.593 - Unable to load plugin icon. Image may have an invalid or unknown format. 15:38:29.597 - Unable to load plugin icon. Image may have an invalid or unknown format. 15:38:29.607 - Unable to load plugin icon. Image may have an invalid or unknown format. 15:38:29.621 - Unable to load plugin icon. Image may have an invalid or unknown format. 73681737 15:38:37.258 - ControlScript is not a valid member of PlayerScripts 15:38:37.258 - Script 'Players.Player.PlayerGui.EntryGui.ENTER.TextButton.LocalScript', Line 8 15:38:37.259 - Stack End

0
Why not just Anchor the Character's Torso and other limbs? M39a9am3R 3210 — 8y
0
I tried that and it didn't work ; game.Players.LocalPlayer.Torso.Anchored = true jefftran60 5 — 8y

1 answer

Log in to vote
1
Answered by
adark 5487 Badge of Merit Moderation Voter Community Moderator
8 years ago

You've made an incredibly common mistake:

On line 6, you simply overwrote the existing Value in Control, you did not change the ControlScript.Disabled property.

To fix that, use an object reference in the variable instead of trying to make a property reference:

local Control = game.Players.LocalPlayer.PlayerScripts.ControlScript

Control.Disabled = true -- Don't forget to set this back to false when you're done!

=============================

If that doesn't work, you should try setting the Player's Humanoid's WalkSpeed and JumpPower properties to 0, as that will allow physics to affect them, but not their inputs.

0
How would I do that? It doesn't work btw It has no error it just doesn't work. jefftran60 5 — 8y
0
I'm not sure what you're asking how to do. adark 5487 — 8y
Ad

Answer this question