Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do i stop my roof and dresser from falling apart?

I did the script for a key that is sitting on a dresser to be picked up but when i run it the dresser the key is sitting on and the roof of the house falls apart. Please help me.

Here the script i used:

local tools = {["Wrench"] = true, ["Key"] = true} local radius = 10 local removeToolUponPickUp = true -- true and the tool is removed when picked up, false and it stays local player = game.Players.LocalPlayer local mouse = player:GetMouse() local running = false local found, hint function getTools() local found = {} for _, c in pairs(game.Workspace:GetChildren()) do if tools[c.Name] then table.insert(found, c) end end return found end

function walking(speed) running = speed > 0 and true or false while running and not found do for _, tool in pairs(getTools()) do local pos = tool:GetModelCFrame().p if player:DistanceFromCharacter(pos) < radius then found = true hint = Instance.new("Hint", player.Character) hint.Text = "Press E to pick up "..tool.Name found = tool while true do if player:DistanceFromCharacter(pos) > radius then hint:Destroy() found = nil break end wait(0.25) end end end wait(0.25) end end

mouse.KeyDown:connect(function(key) if key:lower() == "e" and found then local tool = game.Lighting.Tools[found.Name]:Clone() tool.Parent = player.Backpack if removeToolUponPickUp then found:Destroy() if hint then hint:Destroy() found = nil end end end end)

repeat wait() until player.Character wait(0.5) player.Character.Humanoid.Running:connect(walking)

I do not know what else to do.

1 comment

0

try anhoring the roof/dresser. go to the model section and change it there. you can also lock it but that might affect your script

2 answers

What MagicRemote said.

Weld the roof together or anchor it, same with the dresser.

This discussion is preserved as it was. New answers, comments, and votes are closed.