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

PlatformStand not truly keeping a player down, How else?

Asked by 8 years ago

So I'm making a KO script so that after running out of health your character falls over. I'm looking to use an effect of falling over that is similar to setting PlatformStanding to enabled. My current issue is that, if the players hit backspace then they obviously get up from it. Which I don't want.

-- This will be put into the Players Character Model.
local Character = script.Parent
    local Humanoid = nil -- Setting this up so if we decide to rename the humanoid we still find it.

for Num, On in pairs(Character:GetChildren()) do
    if On:IsA("Humanoid") then
        Humanoid = On
    end
end

local KO_Value = Instance.new("IntValue", Character)
    KO_Value.Name = "Player_KO"
    game.Debris:AddItem(KO_Value, 300)--Just incase

Humanoid.PlatformStand = true

for OnTime = 1, math.ceil(script.KO_Time.Value) do
    wait(1) -- Wait out the time
end

Humanoid.PlatformStand = false
    game.Debris:AddItem(KO_Value, 0.01)

script:remove()

The script is placed into the Character's model, and there's a Number Value inside of it named "KO_Time" (Literally the time in seconds you're going to be KO'd).

Thanks for your time.

1 answer

Log in to vote
0
Answered by 8 years ago

Well, what I suggest is doing as so:

Create a new LocalScript, put it anywhere you like, for this example it will be in ReplicatedStorage. Ensure that the property Disabled has been set to true

Inside this local script, insert the following line of code:

while wait() do
    game.Players.LocalPlayer.Character.Humanoid.PlatformStand = true
end

Then in your main script, instead of using Humanoid.PlatformStand = true use:

local pfscript = game:GetService("ReplicatedStorage")["LOCALSCRIPTNAME"]:Clone()
pfscript.Parent = Character -- Makes player fall
pfscript.Disabled = false

-- Insert whatever you need to do

pfscript:Destroy -- Lets player get back up

If you don't understand what this is doing, it is just a localscript you put into your character which will set PlatformStand to true whenever the script is in the Character and is Enabled.

If this doesn't work, or you have a question, just say so.

Ad

Answer this question