So basically I need some help with my Object Carry System. It can be found in the tool box and there is a video of it. There were a few mistakes the creator had made by accident and you need to create an action animation to go with it but I've figured it out all by myself. There are no more mistakes but I want to add to it so I've been experimenting to try and create a random position teleporter in my script so it will make the give teleport to two random location and pick one at random. Here's the ones I've fixed:
Anim Script:
while(1)do
wait(1)
while script.Parent.Anim.Value == 'true' do
wait(10)
workspace:FindFirstChild(script.Parent.Owner.Value).RightHand.JobBox:Destroy()
script.Parent.Anim.Value = 'false'
script.Parent.Taken.Value = 'false'
end
end
Box Script
script.Parent.ClickDetector.MouseClick:Connect(function(player)
local take = script.Parent.Parent.Taken
if take.Value == 'false' and script.Parent.Parent.Anim.Value == 'false' then
take.Value = 'true'
local box = script.Parent.JobBox:Clone()
box.Anchored = false
box.Parent = workspace:FindFirstChild(player.Name).RightHand
local weld = Instance.new('Weld')
weld.Parent = box
weld.Part0 = box
weld.Part1 = workspace:FindFirstChild(player.Name).RightHand
weld.C0 = CFrame.new(1.5,0,0)
script.Parent.Parent.Anim.Value = 'true'
local char = workspace:FindFirstChild(player.Name)
local flip = Instance.new("Animation")
flip.AnimationId = "http://www.roblox.com/asset/?id=5681405205"
flip.Parent = char
local animloader2 = char.Humanoid:LoadAnimation(flip )
animloader2:Play()
script.Parent.Parent.Owner.Value = player.Name
while(1) do
wait(1)
if script.Parent.Parent.Anim.Value == 'false' then
animloader2:Stop()
end
end
end
end)
Once you've done that there's one more bit of code and this is the part I need help with:
local position1 = (-66.91, 5.56, -100.99)
local position2 = (-66.91, 5.56, -100.99)
script.Parent.Touched:Connect(function(Hit)
local player = game.Players:GetPlayerFromCharacter(Hit.Parent.Parent)
print(Hit.Parent.Name)
local char = Hit.Parent
if Hit.Name == 'JobBox' then
print('BOXHIT')
script.Parent.Parent.Anim.Value = 'false'
script.Parent.Parent.Taken.Value = 'false'
player.leaderstats.Cash.Value = player.leaderstats.Cash.Value + 2
Hit:Destroy()
script.Parent.Parent.AnimScript.Disabled = true
script.Parent.Parent.AnimScript.Disabled = false
script.Parent.Position = math.random(position1, position2)--<== Here
end
end)
Thank you.

1 comment
Oh