Now I've got this:
bin = script.Parent
function onButton1Down(mouse)
r = math.random(1,3)
print(r)
pos = game.Players.LocalPlayer.Character.PrimaryPart.Position
if r == 1 then
print("1 chosen")
wait(2)
zom = script.Parent.TZombie:clone()
zom.Name = script.Parent.Parent.Parent.Name.. "'s Curse"
zom.Target.Value = script.Parent.Parent.Parent.Name
zom.Parent = game.Workspace
zom:MakeJoints()
zom:MoveTo(pos.x + 5, pos.y, pos.z)
else
if r == 2 then
print("2 chosen")
wait(2)
zom = script.Parent.HZombie:clone()
zom.Name = script.Parent.Parent.Parent.Name.. "'s Helper"
zom.Target.Value = script.Parent.Parent.Parent.Name
zom.Parent = game.Workspace
zom:MakeJoints()
zom:MoveTo(pos.x + 5, pos.y, pos.z)
else
game.Players.LocalPlayer.Character:MoveTo(game.Workspace.TeleTo.Position)
print("3 chosen")
end
end
script.Parent:remove()
end
function onSelected(mouse)
mouse.Icon = "rbxasset://textures\\GunCursor.png"
mouse.Button1Down:connect(function() onButton1Down(mouse) end)
end
bin.Selected:connect(onSelected)
But whenever it selects option 1 or 2, it says "Cannot cast double Vector3" and points to the MoveTo line. |