Trying to make an ice move for my game, but it keeps giving me this error Error : https://media.discordapp.net/attachments/812374695545667615/815924831198511154/unknown.png
Script:
local ReplicatedStorage = game:WaitForChild("ReplicatedStorage") local Remote = game.ReplicatedStorage.Events:WaitForChild("IceRemote") Remote.OnServerEvent:Connect(function(player) local Character = player.Character local RootPart = Character:WaitForChild("HumanoidRootPart") local folder = workspace:FindFirstChild("DebrisFolder") or Instance.new("Folder",workspace) folder.Name = "DebrisFolder" local Position = Instance.new("BodyVelocity",RootPart) Position.MaxForce = Vector3.new(99999999999999999999,99999999999999999999,99999999999999999999) Position.P = 300 Position.Velocity = RootPart.CFrame.LookVector * .1 game.Debris:AddItem(Position,2) local val = -4 local sizez = 3 local sizex = 10 local sideval = .5 local function Ice() local extra = math.random(-11,11)/10 local Shard = game.ReplicatedStorage.IceRemoteEffects:WaitForChild("IceShard"):Clone() local side = math.random(-sideval,sideval) up = Shard.Size.Y/2 local rotate = math.random(0,180) local MRo = math.random(99,100) if MRo == 99 then local SRo = math.random(8,10)/10 URo = MRo + SRo else local SRo = math.random(1,3)/10 URo = MRo + SRo end Shard.Size = Vector3.new(sizez,sizex,sizez) Shard.CFrame = RootPart.CFrame.new(side,-up.val + extra) Shard.Parent = folder Shard.CFrame = Shard.CFrame * CFrame.fromEulerAnglesXYZ(URo,rotate,0.4) val = val - 2 sizez = sizez + 1 sizex = sizex + 1 sideval = sideval + .5 game.Debris:AddItem(Shard,5) spawn(function() wait(.5) local TweenService = game:GetService("TweenService") local TweenInform = TweenInfo.new( .3, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0 ) local Properties = { CFrame = Shard.CFrame * CFrame(0,up * 1.5, 0) } local Tween = TweenService:Create(Shard,TweenInform,Properties) Tween:Play() end) end for i = 1,50 do Ice() wait() end end)
At line 42 you tried to do RootPart.CFrame.new, which you can’t do. I’m assuming you tried to multiply CFrames.
local ReplicatedStorage = game:WaitForChild("ReplicatedStorage") local Remote = game.ReplicatedStorage.Events:WaitForChild("IceRemote") Remote.OnServerEvent:Connect(function(player) local Character = player.Character local RootPart = Character:WaitForChild("HumanoidRootPart") local folder = workspace:FindFirstChild("DebrisFolder") or Instance.new("Folder",workspace) folder.Name = "DebrisFolder" local Position = Instance.new("BodyVelocity",RootPart) Position.MaxForce = Vector3.new(99999999999999999999,99999999999999999999,99999999999999999999) Position.P = 300 Position.Velocity = RootPart.CFrame.LookVector * .1 game.Debris:AddItem(Position,2) local val = -4 local sizez = 3 local sizex = 10 local sideval = .5 local function Ice() local extra = math.random(-11,11)/10 local Shard = game.ReplicatedStorage.IceRemoteEffects:WaitForChild("IceShard"):Clone() local side = math.random(-sideval,sideval) up = Shard.Size.Y/2 local rotate = math.random(0,180) local MRo = math.random(99,100) if MRo == 99 then local SRo = math.random(8,10)/10 URo = MRo + SRo else local SRo = math.random(1,3)/10 URo = MRo + SRo end Shard.Size = Vector3.new(sizez,sizex,sizez) Shard.CFrame = RootPart.CFrame * CFrame.new(side,-up.val + extra) Shard.Parent = folder Shard.CFrame = Shard.CFrame * CFrame.fromEulerAnglesXYZ(URo,rotate,0.4) val = val - 2 sizez = sizez + 1 sizex = sizex + 1 sideval = sideval + .5 game.Debris:AddItem(Shard,5) spawn(function() wait(.5) local TweenService = game:GetService("TweenService") local TweenInform = TweenInfo.new( .3, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0 ) local Properties = { CFrame = Shard.CFrame * CFrame(0,up * 1.5, 0) } local Tween = TweenService:Create(Shard,TweenInform,Properties) Tween:Play() end) end for i = 1,50 do Ice() wait() end end)