Hello! Im making this sort batim fangame. and the seeing tool doesnt work when removed and put back in backpack. theres no errors. but it breaks. please help.
script :
local Plr = game.Players.LocalPlayer
local Char = Plr.CharacterAdded:Wait() or Plr.Character
local function Pulled()
workspace.Sounds.SeeingTool.SeeingToolOn:Play()
workspace.Sounds.SeeingTool.BuzzLoop:Play()
Char.Humanoid.WalkSpeed = 0
Char:WaitForChild(“CameraBobble”).Enabled = false
Plr.PlayerScripts:WaitForChild(“Sprint”).Enabled = false
end
local function Removed()
workspace.Sounds.SeeingTool.SeeingToolOff:Play()
workspace.Sounds.SeeingTool.BuzzLoop:Stop()
Char.Humanoid.WalkSpeed = 10
Char:WaitForChild(“CameraBobble”).Enabled = true
Plr.PlayerScripts:WaitForChild(“Sprint”).Enabled = true
end
I have one question. Is the script for getting inside a server script? I assume so.
And if so, my suggestion is instead of removing tools from the backpack, just disable the backpack CoreGui.
You can use a RemoteEvent to fire inside of the script for getting in, and in a LocalScript (I would put it in StarterPlayerScripts), you can use this code:
local replicatedStorage = game:GetService("ReplicatedStorage")
local starterGui = game:GetService("StarterGui")
local remote = replicatedStorage = replicatedStorage:WaitForChild("RemoteEvent") --// Change the name here to whatever you name your RemoteEvent, and if you put it anywhere else inside of ReplicatedStorage, like in a remotes folder for example, change this line to look for it in that folder.
local function ChangeBackpack(context: string)
if context == "Disable" then
starterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)
elseif context == "Enable" then
starterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, true)
end
end)
remote.OnClientEvent:Connect(ChangeBackpack)
When you fire the RemoteEvent from the server script, you have to send “Disable” whenever you enter, and send “Enable” when you exit.
If you need any additional help, like how to set this up, I’m more than happy to help you out. Just let me know!