I’ve been trying to make this rotation thing for about an hour now, but It just seems to give me ‘Unable to cast token to token’.
I think it’s broken or something.
I’m trying to achieve the part being able to be rotated, but all I get is this error.
Unable to cast token to token
inc = the increment (0.5)
script.RotationHandles.MouseDrag:Connect(function(norm, dist)
local p = script.RotationHandles.Adornee
local rot = p.Orientation
rot = rot*Vector3.FromNormalId(norm)*inc*dist/15
end)
If so, Vector3.FromNormalId(norm) should error as norm will be a Axis, instead of a NormalId.
script.RotationHandles.MouseDrag:Connect(function(axis,dist)
local p = script.RotationHandles.Adornee
local rot = p.Orientation*Vector3.FromAxis(axis)*inc*dist/15
end)
Also, that won’t change the Orientation, if you want it to then you should assign to Orientation.
script.RotationHandles.MouseDrag:Connect(function(axis,dist)
local p = script.RotationHandles.Adornee
p.Orientation = p.Orientation*Vector3.FromAxis(axis)*inc*dist/15
end)
Sidenote: Setting CFrame would probably be better in this case
This is weird, I found out about this error right now as a matter of a fact, but what does it mean? Unable to cast token to token
See this is how my script looks like.
player = game:GetService("Players").LocalPlayer
local CorrectGui = player:FindFirstChild("PlayerGui")
game.ReplicatedStorage.GuiTrigger.OnClientEvent:Connect(function(player)
local Goal = UDim2.new(0,0,0,0)
CorrectGui.ScreenGui.TPFrame:TweenPosition(Goal,Enum.EasingStyle.Back,Enum.EasingDirection.Out,0.1,false)
wait(1)
local Goal2 = UDim2.new(-1.03,0,0,0)
CorrectGui.ScreenGui.TPFrame:TweenPosition(Goal2,Enum.EasingStyle.Back,Enum.EasingDirection.In,0.1,false)
end)
Same issue here. Again related to the “TweenPosition” function. There really shouldn’t be an issue here but for some reason there is. I couldn’t find any other post even mentioning this error so this is currently the only shot I have at figuring out whats wrong.
Code:
local menu = nil
local mod = require(script.Parent:WaitForChild("clientmodule"))
local PLAYERS,STORAGE,player = mod.getbasics()
local drews = require(STORAGE:WaitForChild("drews"))
local ui = player.PlayerGui:WaitForChild("ui")
local function setmenu(selected)
if menu and menu ~= selected then end
if selected == 0 then ui.drews:TweenPosition(UDim2.new(0.5,0,(menu == 0 and 1.5 or 0.5),0),Enum.EasingStyle.Quad,Enum.EasingDirection.Out,0.1) end -- the line that causes an error
menu = selected
end
ui:WaitForChild("drewbutton").MouseButton1Down:Connect(function() setmenu(0) end)