You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
the bee does not move when i am standing still and maybe moves to me -
What is the issue? Include screenshots / videos if possible!
he goes out side of the map -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
setting the CFrame to the rootpart
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
--bee script
--game.ServerStorage.WayPoint
-- child of the bee model
local runservice = game:GetService("RunService")
function pfunction()
runservice.Heartbeat:Wait()
local owner = script.Parent.Owner.Value
local waypoint = game.ServerStorage.WayPoint:Invoke(owner.Character.Humanoid.RootPart.Position)
local model = script.Parent
local cframe = model:GetPivot()
runservice.Stepped:Wait()
--model:PivotTo(CFrame.new(model:GetPivot().Position,waypoint.Position))
if waypoint.Position == cframe.Position then
model:PivotTo(owner.Character.Humanoid.RootPart.CFrame)
else
for i = 0,1,0.1 do
runservice.Stepped:Wait()
local theCFrame = cframe:Lerp(waypoint.CFrame,i).Position
model:PivotTo(CFrame.lookAt(theCFrame,waypoint.Position))
end
model:PivotTo(CFrame.lookAt(waypoint.Position,owner.Character.Humanoid.RootPart.Position))
end
local lastknownCFrame = waypoint.CFrame
waypoint:Destroy()
return lastknownCFrame
end
while script.Parent.Owner.Value.Parent do
task.wait()
local success,lastknownCFrame = pcall(pfunction,script.lastknownCFrame.Value)
if success then
script.lastknownCFrame.Value = lastknownCFrame
else
print(lastknownCFrame)
end
end
script.Parent:Destroy()
--ServerScriptService
game.ServerStorage.WayPoint.OnInvoke = function(pos)
local beeWaypoint = Instance.new("Part")
beeWaypoint.Position = pos
beeWaypoint.Shape = Enum.PartType.Ball
beeWaypoint.Size = Vector3.new(1,1,1) * 1
beeWaypoint.Anchored = true
beeWaypoint.Transparency = 0.7
beeWaypoint.CanCollide = false
beeWaypoint.Parent = workspace
beeWaypoint.Name = 'beeWaypoint'.. script.WaypointCount.Value
game:GetService("Debris"):AddItem(beeWaypoint,7)
script.WaypointCount.Value += 1
return beeWaypoint
end
function spawnbee(player)
local bee = game.ServerStorage.Bee:Clone()
bee.Owner.Value = player
bee.Parent = workspace
end
game.Players.PlayerAdded:Connect(spawnbee)
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.