#broken script
1 messages · Page 1 of 1 (latest)
the obj you want to tween
bro
did you read what i said?
@blazing crypt
ok
so you want to tween every object called show?
every object that has an object inside named show
okay so im guessing you currently have the folder or whatever the "show" objects are in
ye
so loop the object and check name
for _, v in pairs(folder:GetDescendants()) do
if v.Name == "Show" then
something here...
end
end```
where do i put that
** You are now Level 1! **
well i think you want to put your tween inside the if statment
then that loop where the tween was
like this?
huh
after the "if"
the 2 lines below it
add a space or tab whatever you call it
if v.Name == "Show" then
> local tween
> tween:Play()
end```
wym
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
** You are now Level 2! **
no, its a boolvalue, inside all the objects that i want it to work with'
nothing
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
this is mine, this is what i have😭 but in this clip i had the script on only the crowbar, i just want so it works with all the items
what was the orignal script?
this?
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
okay and if it has show then what are we doing
then you can pick it up like in the video
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
ok
?
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
ok
yes
okay try that
error
** You are now Level 3! **
last line
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)```
error when i try to pickup'
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
and btw, its one more "end"
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)```
okay good
it will be laggy because of how long you wait
wdym
no
i think they get stuck underground
when i change item
but the crowbar and tape stay
then you could set a table of the items with a defult pos then reset to defult pos on switch or drop
any other code?
@amber cobalt
ye
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
ok..
** You are now Level 4! **
uhhm, its not when i change item, the keys and hammer just falls through the floor from nowhere, wth
but crowbar and tape stays
so no keys are pressed?
ye
okay well i would print currentTool
and see what changes
if it changes to something else for no reason u know your issue
or when i pick up it and then drop it, it just falls like 5sec later
where
ok
now they just disapered when i swaped items, but it never printed the wrong item
@amber cobalt
yo?
check the folder
they fall through the floor
their still there
uhh
after a while they disapered from the folder
wth
@amber cobalt
anchor?
can collide?
you do change that in your script
ye, they were not anchord, im so stupid lol
only the crowbar and tape were
tysm
np
@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
what as you can see the gui?
No, to how far away you can pick up the item
Then
You check if the gui is visible
that didnt work cus im using mouse.target, so that means the ui is always visible even tho the max distance on the ui is 16, it does something else to hide it, im not sure what tho
Okay so check the distance away from the tool
But surely the gui is not disable after 16 distance?