#broken script

1 messages · Page 1 of 1 (latest)

cursive summit
#

what should i put here? i have multiple objects that i want this to work with so i have an object called "show" in every object i want it to work with. but when it comes to the tween if i use mouse.target it just breaks bc after i pick up the object the mouse will target something else, so what should i use instead?

cursive summit
#

did you read what i said?

#

@blazing crypt

blazing crypt
#

Np

#

My bad

#

I'm not at home rn

cursive summit
amber cobalt
cursive summit
amber cobalt
cursive summit
#

ye

amber cobalt
#

so loop the object and check name

for _, v in pairs(folder:GetDescendants()) do
  if v.Name == "Show" then
    something here...
  end
end```
cursive summit
#

where do i put that

hasty topazBOT
#

studio** You are now Level 1! **studio

amber cobalt
#

then that loop where the tween was

cursive summit
#

wdym

#

oh

#

nvm

amber cobalt
#

you got it?

#

check if it works

cursive summit
#

like this?

amber cobalt
#

well

#

the tween and play have to be indented one more

#

but yeah

cursive summit
#

huh

amber cobalt
#

the 2 lines below it

#

add a space or tab whatever you call it

#
if v.Name == "Show" then
>  local tween
>  tween:Play()
end```
cursive summit
#

@amber cobalt

amber cobalt
#

press tab

#

not space

cursive summit
#

ok

#

did that

#

but what do i put at the question marks

#

@amber cobalt

amber cobalt
#

Put v

cursive summit
#
local tweenService = game:GetService('TweenService')
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()


local player = game.Players.LocalPlayer
local camera = workspace.CurrentCamera

local info = TweenInfo.new(
    0,
    Enum.EasingStyle.Linear
)

local debounce = false

inputservice.InputBegan:Connect(function(input, IS)
    if IS == true then return end

    if input.KeyCode == Enum.KeyCode.E and mouse.Target then
        if mouse.Target:FindFirstChild("Show") then
            mouse.Target:FindFirstChild("Show").Parent.CanCollide = false

        while task.wait() do
            local targetCFrame = camera.CFrame * CFrame.new(2.5,-1,-2) * CFrame.Angles(math.rad(-90), math.rad(0), 0)
            
                for _, v in pairs(workspace.Tools:GetDescendants()) do
                    if v.Name == "Show" then
                         local tween = tweenService:Create(??, info, {CFrame = targetCFrame})
                         tween:Play()
                    end
                end


            
    if input.KeyCode == Enum.KeyCode.G and not debounce then
        tween:Destroy()
             end
          end
       end
    end
end)
#

@amber cobalt

hasty topazBOT
#

studio** You are now Level 2! **studio

amber cobalt
#

Instead of ??

#

Put v

cursive summit
#

ohh

#

im dumb

#

error

amber cobalt
#

is it a module?

#

a group?

#

a part?

cursive summit
#

no, its a boolvalue, inside all the objects that i want it to work with'

amber cobalt
#

wait now you have confused me

#

what do you want to move?

cursive summit
#

nothing

amber cobalt
#

so why are you using tween

#

oh well

#

what do you want to do

cursive summit
#

wait

amber cobalt
#

okay well idk how to animate a tool like htat

#

like i do

#

but idk how you would offset it

#

and what not

#

@blazing crypt prob has a better idea

cursive summit
amber cobalt
#

what was the orignal script?

cursive summit
#

same but instead of the mouse.target things it was only connected to the crowbar

#

instead of it checking if the targeted object has "show" in it

#

it just checked if it was crowbar

amber cobalt
#

okay and if it has show then what are we doing

cursive summit
amber cobalt
#

okay but in your script you do not even know what tool is picked up

#

or when to exit the loop

#
local inputservice = game:GetService('UserInputService')
local tweenService = game:GetService('TweenService')
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local currentTool = nil


local player = game.Players.LocalPlayer
local camera = workspace.CurrentCamera

local info = TweenInfo.new(
    0,
    Enum.EasingStyle.Linear
)

local debounce = false

inputservice.InputBegan:Connect(function(input, IS)
    if IS == true then return end

    if input.KeyCode == Enum.KeyCode.E and mouse.Target then
        if mouse.Target:FindFirstChild("Show") then
            mouse.Target:FindFirstChild("Show").Parent.CanCollide = false
            currentTool = mouse.Target.Name

        while task.wait() do
            local targetCFrame = camera.CFrame * CFrame.new(2.5,-1,-2) * CFrame.Angles(math.rad(-90), math.rad(0), 0)
            
            local tween = tweenService:Create(currentTool, info, {CFrame = targetCFrame})
            tween:Play()

        currentTool = nil

            
    if input.KeyCode == Enum.KeyCode.G and not debounce then
        tween:Destroy()
             end
          end
       end
    end
end)```
#

@cursive summit mabye try this

cursive summit
#

ok

amber cobalt
#

wait

#

no

cursive summit
#

?

amber cobalt
#
local inputservice = game:GetService('UserInputService')
local tweenService = game:GetService('TweenService')
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local currentTool = nil


local player = game.Players.LocalPlayer
local camera = workspace.CurrentCamera

local info = TweenInfo.new(
    0,
    Enum.EasingStyle.Linear
)

local debounce = false

inputservice.InputBegan:Connect(function(input, IS)
    if IS == true then return end

    if input.KeyCode == Enum.KeyCode.E and mouse.Target then
        if mouse.Target:FindFirstChild("Show") then
            mouse.Target:FindFirstChild("Show").Parent.CanCollide = false
            currentTool = mouse.Target.Name

        while task.wait() do
            for _, v in pairs(workspace.Tools:GetDescendants()) do
                if v.Name == currentTool then
                    local targetCFrame = camera.CFrame * CFrame.new(2.5,-1,-2) * CFrame.Angles(math.rad(-90), math.rad(0), 0)
            
                    local tween = tweenService:Create(currentTool, info, {CFrame = targetCFrame})
                    tween:Play()

        currentTool = nil

            
    if input.KeyCode == Enum.KeyCode.G and not debounce then
        tween:Destroy()
             end
          end
       end
    end
end)```
#

try this

cursive summit
#

ok

amber cobalt
#

but to make sure, tools is a folder

#

and inside you have the tools right

cursive summit
#

yes

amber cobalt
#

okay try that

cursive summit
hasty topazBOT
#

studio** You are now Level 3! **studio

cursive summit
#

last line

amber cobalt
#

oh

#
local inputservice = game:GetService('UserInputService')
local tweenService = game:GetService('TweenService')
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local currentTool = nil


local player = game.Players.LocalPlayer
local camera = workspace.CurrentCamera

local info = TweenInfo.new(
    0,
    Enum.EasingStyle.Linear
)

local debounce = false

inputservice.InputBegan:Connect(function(input, IS)
    if IS == true then return end

    if input.KeyCode == Enum.KeyCode.E and mouse.Target then
        if mouse.Target:FindFirstChild("Show") then
            mouse.Target:FindFirstChild("Show").Parent.CanCollide = false
            currentTool = mouse.Target.Name

        while task.wait() do
            for _, v in pairs(workspace.Tools:GetDescendants()) do
                if v.Name == currentTool then
                    local targetCFrame = camera.CFrame * CFrame.new(2.5,-1,-2) * CFrame.Angles(math.rad(-90), math.rad(0), 0)
            
                    local tween = tweenService:Create(currentTool, info, {CFrame = targetCFrame})
                    tween:Play()
                end

        currentTool = nil

            
    if input.KeyCode == Enum.KeyCode.G and not debounce then
        tween:Destroy()
             end
          end
       end
    end
end)```
cursive summit
#

error when i try to pickup'

amber cobalt
#

what is line 31

#

click the error

#

and show

cursive summit
#

ok

amber cobalt
#

right

#
local inputservice = game:GetService('UserInputService')
local tweenService = game:GetService('TweenService')
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local currentTool = nil


local player = game.Players.LocalPlayer
local camera = workspace.CurrentCamera

local info = TweenInfo.new(
    0,
    Enum.EasingStyle.Linear
)

local debounce = false

inputservice.InputBegan:Connect(function(input, IS)
    if IS == true then return end

    if input.KeyCode == Enum.KeyCode.E and mouse.Target then
        if mouse.Target:FindFirstChild("Show") then
            mouse.Target:FindFirstChild("Show").Parent.CanCollide = false
            currentTool = mouse.Target.Name

        while task.wait() do
            for _, v in pairs(workspace.Tools:GetDescendants()) do
                if v.Name == currentTool then
                    local targetCFrame = camera.CFrame * CFrame.new(2.5,-1,-2) * CFrame.Angles(math.rad(-90), math.rad(0), 0)
            
                    local tween = tweenService:Create(v, info, {CFrame = targetCFrame})
                    tween:Play()
                end

        currentTool = nil

            
    if input.KeyCode == Enum.KeyCode.G and not debounce then
        tween:Destroy()
             end
          end
       end
    end
end)```
#

what about now

cursive summit
cursive summit
amber cobalt
#

i just wrote it on dc

cursive summit
#

i cant move with it

amber cobalt
#

mabye

#
local inputservice = game:GetService('UserInputService')
local tweenService = game:GetService('TweenService')
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local currentTool = nil


local player = game.Players.LocalPlayer
local camera = workspace.CurrentCamera

local info = TweenInfo.new(
    0,
    Enum.EasingStyle.Linear
)

local debounce = false

inputservice.InputBegan:Connect(function(input, IS)
    if IS == true then return end

    if input.KeyCode == Enum.KeyCode.E and mouse.Target then
        if mouse.Target:FindFirstChild("Show") then
            mouse.Target:FindFirstChild("Show").Parent.CanCollide = false
            currentTool = mouse.Target.Name

        while task.wait() do
            for _, v in pairs(workspace.Tools:GetDescendants()) do
                if v.Name == currentTool then
                    local targetCFrame = camera.CFrame * CFrame.new(2.5,-1,-2) * CFrame.Angles(math.rad(-90), math.rad(0), 0)
            
                    local tween = tweenService:Create(v, info, {CFrame = targetCFrame})
                    tween:Play()
                end
            end

            
    if input.KeyCode == Enum.KeyCode.G and not debounce then
        tween:Destroy()
             end
          end
       end
    end
end)```
cursive summit
#

ok

amber cobalt
#

it will be laggy because of how long you wait

cursive summit
#

wdym

amber cobalt
#

mabye its just the vid

#

dw

cursive summit
#

the keys just disapered out of no where..

#

and hammer

#

uhh

#

@amber cobalt

amber cobalt
#

wym

#

did you press g?

cursive summit
#

no

#

i think they get stuck underground

#

when i change item

#

but the crowbar and tape stay

amber cobalt
#

then you could set a table of the items with a defult pos then reset to defult pos on switch or drop

amber cobalt
cursive summit
#

@amber cobalt

amber cobalt
#

okay well that wont do anything

#

not sure why it does that

cursive summit
#

ye

amber cobalt
#

but i would make a table

#

or some sort of value

#

even a value inside of the item

#

then after its dropped or whatever set it to that

cursive summit
#

ok..

hasty topazBOT
#

studio** You are now Level 4! **studio

cursive summit
#

uhhm, its not when i change item, the keys and hammer just falls through the floor from nowhere, wth

#

but crowbar and tape stays

cursive summit
#

ye

amber cobalt
#

okay well i would print currentTool

#

and see what changes

#

if it changes to something else for no reason u know your issue

cursive summit
#

or when i pick up it and then drop it, it just falls like 5sec later

cursive summit
amber cobalt
#

just keep printing it

#

in the task.wait

cursive summit
#

ok

#

@amber cobalt

#

yo?

amber cobalt
cursive summit
#

they fall through the floor

#

their still there

#

uhh

#

after a while they disapered from the folder

#

wth

#

@amber cobalt

amber cobalt
#

can collide?

#

you do change that in your script

cursive summit
#

ye, they were not anchord, im so stupid lol

#

only the crowbar and tape were

#

tysm

amber cobalt
#

np

cursive summit
#

@amber cobalt one more thing, do you know how to make a limit to how far away i can pick it up, bc rn i can be on the other side of the map and still pick it up lol

cursive summit
amber cobalt
#

You check if the gui is visible

cursive summit
#

Okay

#

Ty

amber cobalt
#

Np

#

Happy birthday for 2 days time @cursive summit

cursive summit
#

Tyy

#

😄

cursive summit
amber cobalt
#

But surely the gui is not disable after 16 distance?