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

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

Asked by 3 years ago

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.

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 Hafrew 16 — 3y

2 answers

Log in to vote
0
Answered by 3 years ago

https://www.roblox.com/library/1864709663/Object-Weld

Add this item to inventory, and in studio drag it under the model that you want to be welded together.

Make sure to select your model and in properties choose the primary part, or else you cannot weld it.

Ad
Log in to vote
0
Answered by 3 years ago

What MagicRemote said.

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

Answer this question