-
What do you want to achieve? Keep it simple and clear!
I want to disable the players backpack when they sit and enable it when they get up -
What is the issue? Include screenshots / videos if possible!
When the player sits down, the backpack doesn’t disable -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I have tried YT and Devforum, i have also tried putting the local script in all the places, starter pack, startergui, starterplayerscripts and startercharacterscripts
Heres my local script in starter player scripts
game.ReplicatedStorage.BackpackEvent.OnClientEvent:Connect(function(value)
local StarterGui = game:GetService("StarterGui")
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, value)
end)
And here is my script in server script service (dont mind the other stuff, thats car stuff i have for my game, the important parts are where it fires the remote event “BackpackEvent”
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
character.Humanoid.Seated:Connect(function(active, seatPart)
if seatPart == nil then
game.ReplicatedStorage.HideCarGUI:FireClient(player)
game.ReplicatedStorage.EnableProximityPrompts:FireClient(player)
game.ReplicatedStorage.BackpackEvent:FireClient(player, true)
for i,v in pairs(character:GetDescendants()) do
if v:IsA("BasePart") or v:IsA("Decal") then
if v.Name == "HumanoidRootPart" then
else
v.Transparency = 0
end
end
end
for i,v in pairs(character:GetDescendants()) do
if v.Name == "PickpocketPrompt" and v:IsA("ProximityPrompt") then
game.ReplicatedStorage.PickpocketPromptEvent:FireAllClients(player)
end
end
elseif seatPart.Name == "CarSeat" then
seatPart.Parent.Name = player.Name.."'s Car"
for i,v in pairs(character:GetDescendants()) do
if v:IsA("BasePart") or v:IsA("Decal") then
v.Transparency = 1
end
end
seatPart:SetNetworkOwner(player)
game.ReplicatedStorage.ShowCarGUI:FireClient(player, seatPart)
seatPart.Parent.Owner.Value = player.Name
game.ReplicatedStorage.DisableProximityPrompts:FireClient(player)
game.ReplicatedStorage.BackpackEvent:FireClient(player, false)
elseif seatPart.Name == "PassengerSeat" then
for i,v in pairs(character:GetDescendants()) do
if v:IsA("BasePart") or v:IsA("Decal") then
v.Transparency = 1
end
end
game.ReplicatedStorage.DisableProximityPrompts:FireClient(player)
game.ReplicatedStorage.BackpackEvent:FireClient(player, false)
else
game.ReplicatedStorage.DisableProximityPrompts:FireClient(player)
game.ReplicatedStorage.BackpackEvent:FireClient(player, false)
end
end)
end)
end)
For some reason it just doesnt work, im pretty sure no other scripts are interfering with this because i checked them all. I also tried printing what it does to the backpack and its all good, false when the player sits down and true when they stand up.
Heres a video of it:
Also i tested this in another game and it works, idk what’s wrong, it might be another script somewhere interfering with this