Hello
function onClick(noot)
local val = script.Parent.Parent.TextBox.Value.Value
local text = script.Parent.Parent.TextBox
val = text.Text
local plr = game.Players:FindFirstChild(val)
local val2 = script.Parent.Parent.dis.Value.Value
local text2 = script.Parent.Parent.dis
val2 = text2.Text
local item = game.ServerStorage.SponsorItems:FindFirstChild(val2)
if plr and plr.Character and plr.Character:FindFirstChild("Arm1") and item then
if val2 == "Food" then
local foood = game.ServerStorage.SponsorItems.Food:getChildren()
-- local clone = foood[math.random(1,#foood)]:Clone()
local e = plr.Character.HumanoidRootPart.Position
local ab = Vector3.new(e.x, e.y, e.z)
for i,v in pairs(e) do
game.Workspace.Sponsor.Position = v
end
end
end
end
I'm currently trying to move the part's position to the plr's HumanoidRootPart, but I just don't know how to. I previously tried using another for loop by doing that:
for i = 1, ab, .5 do
game.Workspace.Sponsor.Position = game.Workspace.Sponsor.Position + i
end
I however replaced it with the i,v in pairs thing because it stated ab should be a number, or something like that.
While we're at it, do you guys know how I could give a player a tool when the "Sponsor" part touches the HumanoidRootPart?
Thanks

1 comment
I posted an updated aswser!