Part does not go to the right Position

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    i want a part to go 10 stuts above the player rootpart

  2. What is the issue? Include screenshots / videos if possible!
    wherever i am it goes to not where i want

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    changing things

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!

-- parent = part
script.Parent.Function.OnInvoke = function(partpos,amountOfRotations)
	print'invoked'
	local dice = script.Parent
	dice.Anchored = true
	dice.Transparency =1
	local RunService = game:GetService("RunService")
	script.Parent = game:GetService("ServerScriptService")
	RunService.Heartbeat:Wait()print'Heartbeat:Waited'
	dice.Position = partpos-- + Vector3.new(0,10,0)
	dice:WaitForChild("BodyPosition").Position = partpos-- + Vector3.new(0,10,0)
	local CFrames = {}
	for x= -90,180,90 do
		for y= -90,180,90 do
			for z= -90,180,90 do
				table.insert(CFrames,CFrame.Angles(math.rad(x),math.rad(y),math.rad(z) ) )
			end
		end
	end
	print('inserted cframes',table.unpack(CFrames))
	dice.Transparency =0
	print'roll'
	dice.Anchored = false
	for i = 1,amountOfRotations or 2,1 do
		dice:WaitForChild("BodyGyro").CFrame = CFrames[math.random(1,#CFrames)]
		print(i)
		wait(0.5)
	end
	dice.BodyPosition:Destroy()
	dice.BodyGyro:Destroy()
	wait(15)
	dice.AssemblyAngularVelocity = Vector3.new()
	dice.AssemblyLinearVelocity = Vector3.new()
	--dice.Anchored = true
	dice.Orientation = Vector3.new(table.unpack({
		math.floor(dice.Orientation.X),
		math.floor(dice.Orientation.Y),
		math.floor(dice.Orientation.Z),
	}))
	wait(5)
	dice.Transparency = 1
	task.delay(2,function()
		script:Destroy()
		dice:Destroy()
	end)
	return dice.Orientation
end
local nowMF = script.Parent.BodyPosition.MaxForce
script.Parent.BodyPosition.MaxForce = Vector3.new(nowMF.X,math.huge,nowMF.Z)
local qin2007RootPartPos = game.Players.PlayerAdded:Wait().CharacterAdded:Wait():WaitForChild'HumanoidRootPart'.Position--
local clone = game.ServerStorage.Dice:Clone()
clone.Parent = workspace
wait(5)
local RunService = game:GetService("RunService")
RunService.Stepped:Wait()
print(clone.Function:Invoke(qin2007RootPartPos,5))

i dont know where i errored

PlayerAdded:Wait()

Doesn’t fire in local scripts.

local RunService = game:GetService("RunService")
local Storage = game:GetService("ReplicatedStorage")
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local HRP = Character:WaitForChild("HumanoidRootPart")
local Dice = Storage:WaitForChild("Dice")
local diceClone = Dice:Clone()
diceClone.Parent = workspace

task.wait(5)

RunService.Stepped:Wait()
local diceOrientation = diceClone.Function:Invoke(HRP.Position,5)
print(diceOrientation)

You also can’t access the ServerStorage folder from local scripts either as instances contained inside of it do not replicate to the client, use the ReplicatedStorage folder instead as I have done above. You were also only recording the value assigned to the “Position” property of the HumanoidRootPart instance of the player’s character model once when the local script was first executed, as opposed to recording it each time the server is invoked.

I’ll take a look at the other script soon.

It looks like you’ve commented this out, which might explain why it doesn’t go 10 studs above the root part:

dice.Position = partpos-- + Vector3.new(0,10,0)

even with that it still does not go there

it is a script!
how did you think it was?

Because “game.Players.LocalPlayer” is being used to define the local player. That reference isn’t defined in server scripts and just points to nil.

if it was a localscript i did

game.Players.LocalPlayer.CharacterAdded:Wait():WaitForChild'HumanoidRootPart'.Position

but becouse it is not i did

it isa script

local RunService = game:GetService("RunService")
local Storage = game:GetService("ServerStorage")
local Players = game:GetService("Players")
local Dice = Storage:WaitForChild("Dice")
local diceClone = Dice:Clone()
diceClone.Parent = workspace

Players.PlayerAdded:Connect(function(Player)
	local Character = Player.Character or Player.CharacterAdded:Wait()
	if Character then
		local HRP = Character:WaitForChild("HumanoidRootPart")
		task.wait(5)
		RunService.Stepped:Wait()
		local diceOrientation = diceClone.Function:Invoke(HRP.Position,5)
		print(diceOrientation)
	end
end)