So i'm making a fire ball and i'm scripting it so when it hits something it expands in size and then disappears. I'm using the TweenService for this and it comes back with an error saying "Unable to cast to dictionary". I then tried to use the pcall function to see if it would work but no it didn't. I don't understand, any help?
Here is my script.
game.ReplicatedStorage.Events.FireBallEvent.OnServerEvent:Connect(function(plr)
local fire = Instance.new("Part")
fire.Parent = workspace
fire.Shape = "Ball"
fire.Material = Enum.Material.Neon
fire.CFrame = plr.Character.UpperTorso.CFrame
fire.Size = Vector3.new(4,4,4)
fire.CanCollide = false
fire.BrickColor = BrickColor.new("Bright yellow")
fire.Anchored = false
local bv = Instance.new("BodyVelocity",fire)
bv.Velocity = plr.Character.UpperTorso.CFrame.LookVector.Unit * 50
bv.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
if fire.Parent == workspace then
local tween = game:GetService("TweenService")
local tweeninfo = TweenInfo.new(
1,
Enum.EasingStyle.Linear,
Enum.EasingDirection.Out,
0,
false,
1)
local properties = {
Size = Vector3.new(10,10,10)
}
local create = tween:Create(tweeninfo,properties,fire)
fire.Touched:connect(function(hit)
create:Play()
if hit.Parent:FindFirstChild('Humanoid') then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
return nil
else
hit.Parent.Humanoid:TakeDamage(5)
end
end
end)
if fire.Parent == workspace then
wait(3)
fire:Destroy()
end
end
end)

1 comment
Thank you so much!