So i have this unusual incident today, i made a sphere with a tween that must become 0.5 transparent, 16,16,16 sized, cannot be collided with, and in order to activate it, a player with a humanoid must touch it
But, even when i moved it from the baseplate, it still continued to tween without the permission
The output reports no exceptions tho
local TweenService = game:GetService("TweenService") local sphere = script.Parent local goal = {} sphere.Transparency = 0.5 sphere.Size = Vector3.new(16, 16, 16) sphere.Color = Color3.new(0.203922, 0.8, 0.854902) sphere.CanCollide = false local info = TweenInfo.new( 3, Enum.EasingStyle.Cubic, Enum.EasingDirection.Out, 0, true, 1 ) local sphereTween = TweenService:Create(sphere, info, goal) sphere.Touched:Connect(function(otherPart) local humanoid = otherPart.Parent:FindFirstChildWhichIsA("Humanoid") if humanoid then sphereTween:Play() end end)
It's better to be using if humanoid ~= nil then
so it checks if the object contains humanoid or not. It's a better way to check for humanoid.
Also, if you want to tween the transparency and stuff, put that inside the table.
Make sure that there is no colliding humanoids, if you want this to work only for the player, use game.Players:GetPlayerFromCharacter(otherPart.Parent)
so it would look like this:
local TweenService = game:GetService("TweenService") local sphere = script.Parent local goal = { Transparency = 0.5, Size = Vector3.new(16, 16, 16), Color = Color3.new(0.203922, 0.8, 0.854902), -- Since CanCollide can't be tweened, you can still put it here CanCollide = false } local info = TweenInfo.new( 3, Enum.EasingStyle.Cubic, Enum.EasingDirection.Out, 0, true, 1 ) local sphereTween = TweenService:Create(sphere, info, goal) sphere.Touched:Connect(function(otherPart) local humanoid = otherPart.Parent:FindFirstChildWhichIsA("Humanoid") if humanoid ~= nil and game.Players:GetPlayerFromCharacter(otherPart.Parent) then sphereTween:Play() end end)