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

Bottle does not leave ground? HELP NEEDED!

Asked by 7 years ago
--creates bottle up on click

mousedown = false
part = script.Parent
starteddown= 0

local player = game.Players.LocalPlayer
local mouse = player:GetMouse()





mouse.Button1Down:connect(function()
    mousedown = true
    while mousedown == true do
        part.Anchored = true
        part.Position = part.Position + Vector3.new(0,0.3, 0)   
        print("Button one down")
    wait()
        end

end)












mouse.Button1Up:connect(function()
    mousedown = false
    script.Parent.Anchored = false
end)

--need to create down motion 












--checks if hit

local part3 = game.Workspace.BOTTLE.Union

part3.Parent.Touched:connect(function(hit)
    local find = hit.Parent:FindFirstChild("top")
    if find ~= nil then
        part3.Anchored = true
    else
        part3.Anchored = false
    end
end)

No errors pop up in the output, the bottle just doesnt leave the table when the mouse is held down

0
I'm confused as hell right now. I'll see if I can fix this. Meltdown81 309 — 7y

1 answer

Log in to vote
-1
Answered by 7 years ago

Ok here you go:

ply = game.Players.LocalPlayer
mouse = ply:GetMouse()
go = false

function Up()
    game.Workspace.Part.Anchored = true
    game.Workspace.Part.CFrame = game.Workspace.Part.CFrame * CFrame.new(0,0.3,0)
end

while true do
mouse.Button1Down:connect(function()
    go = true
end)
mouse.Button1Up:connect(function()
    go = false
    game.Workspace.Part.Anchored = false
end)
if go == true then
    Up()
else
    game.Workspace.Part.Anchored = false
end
wait(0.1)
end

Just replace part's directory with script.Parent.

0
I put this inside a local script. It didn't work. Did you put it in a regualr script? RenderingPixel -5 — 7y
0
-_- Did you change the directory from game.Workspace.Part to the directory for the bottle. Also I put this in PlayerScripts so my bad. Meltdown81 309 — 7y
0
Still nothing... RenderingPixel -5 — 7y
0
u mean starter player scripts? RenderingPixel -5 — 7y
View all comments (4 more)
0
Yes. Is there any error in the output and you should probably use bodyposition imo. Meltdown81 309 — 7y
0
there is no error in the output RenderingPixel -5 — 7y
0
Please explain the reasoning behind your answer, as it doesn't help the OP to understand why he should do this & that. TheeDeathCaster 2368 — 7y
0
^^This was posted 7 days ago. This is a basic script and is pretty straightforward so there is no reason to explain what's already there. Meltdown81 309 — 7y
Ad

Answer this question