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

I made cuff scripts but players can just reset out of them. How can I stop this?

Asked by 6 years ago

Here's the server side script as the local script just fires the event:

local RemoteEvent = script.Parent.RemoteEvent
local Using = false
local TargetTorso

function CheckForChar(Part)
    if Part.Parent:IsA'Model' and Part.Parent:FindFirstChildOfClass'Humanoid' then
        local Char = Part.Parent
        local Torso
        if Char:FindFirstChild("Torso") then
            Torso = Char.Torso
        else 
            Torso = Char.UpperTorso
        end
        TargetTorso = Torso
        return Char
    end
end

function CheckForTorso(player)
    local Char = player.Character
    if Char:FindFirstChild("Torso") then
        return Char.Torso
    else 
        return Char.UpperTorso
    end
end

RemoteEvent.OnServerEvent:Connect(function(player, one, two)
    if one == 'Cuff' then

        local Target = CheckForChar(two)        
        local PlayerTorso = CheckForTorso(player)

        if Target then
            Using = true
            RemoteEvent:FireClient(player, 'Use')
            spawn(function()

                while Using and wait() do
                    TargetTorso.Anchored = true
                    TargetTorso.CFrame = PlayerTorso.CFrame * CFrame.new( 0, 0, -2.5 )

                end             

            end)            

        end

    elseif one == 'UnCuff'then

        Using = false       
        wait()
        TargetTorso.Anchored = false        

    end

end)
0
This doesn't change anything? VeryDarkDev 47 — 6y
0
You dont have to say it twice, incapaz. ILikeTofuuJoe 1 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

Just re-name the Target's humanoid, that prevents resetting. Try something like this:

Char.Humanoid.Name = "Target"

And rename it back to "Humanoid" to allow the player to reset again

0
I'll try both solutions VeryDarkDev 47 — 6y
0
That won't work. Roblox's RESET button uses Character:BreakJoints(), not humanoid. hellmatic 1523 — 6y
0
It worked actually :) but thank you for suggestions VeryDarkDev 47 — 6y
Ad

Answer this question