Stun script won't remove players toolbar

  1. What do you want to achieve? I want a script that removes the players toolbar and currently equipped tool when they are stunned by a weapon.

  2. What is the issue? No method I’ve tried worked. I’ve tried a ServerScriptService that detects if leg collisions are on or off which hasn’t worked, I’ve tried setting attributes like “IsStunned” but that didn’t work either.

  3. What solutions have you tried so far? I’ve tried 5 different methods and none of them have worked, found nothing similar on the dev forum.

Is there a better way to do this or am I missing something? I thought it’d be pretty simple, just checking if the player’s legs have collision on or off and then disabling / enabling the toolbar from there but my methods aren’t working. I’ve tried setting debug prints but nothing ever came out in the output either. No idea what to do from here.

Could you please share the scripts that you’ve used here? So we can help you better and easier.

local backpack = HitCharacter:FindFirstChildOfClass(“Backpack”)
local characterTools = {}

if backpack then
    for _, item in pairs(backpack:GetChildren()) do
        if item:IsA("Tool") then
            table.insert(characterTools, item)
            item.Parent = nil 
        end
    end
end

This is the one I worked on last. When somebody was hit by the stun weapon it would, theoretically, remove their weapons, store them and give them back after the stun ended - yet nothing happened.

i’d use :UnequipTools() on the target humanoid in the server script to get rid of all the equipped items and then set up a remote event in which you use fireclient for the target and on the client side you disable the toolbar by game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)

This method actually worked with a few tweaks to fit my current game set-up. No idea how I didn’t think of a RemoteEvent after 5 tries LOL

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.