Old roblox model respawn selectionbox effect

lol it only opens roblox studio

It’s a model. Drag and drop it into the workspace or right click workspace and click import from file


ok trying to do this atm

1 Like

It worked fine for the model I sent. You implemented it wrong. By the way that video is not helpful at all. We are here to help you, and you could at least try to make it easier.

1 Like

the video is the code @Angrybirdcharacter provided in post 19

Heyo, so I suggest looking up “Old Roblox” in the toolbox, I remember there are a few good classic looking Roblox Scripts.

Alright, sorry for the long reply but this is because you are setting the color everytime in the while loop so tweening the color doesnt work as expected

local TweenService = game:GetService([==[TweenService]==])
local animation = TweenInfo.new(1,Enum.EasingStyle.Linear)
local colorlist = {
Color3.new(1,0,0),--Red
Color3.new(0,0,1)--Blue
}
local index = 1
local function ToggleSelectionBox(Vehicle)
	for i, v in pairs(Vehicle.BodyKit:GetDescendants()) do
		if v:IsA('BasePart') then
			local SelectionBox = Instance.new('SelectionBox')
			SelectionBox.Parent = v
			SelectionBox.Adornee = v
            spawn(function()
  			 while true do
				local goal = {Color = colorlist[index]}
				local tween = TweenService:Create(SelectionBox, animation, goal)
				tween:Play()
                if index==#colorlist then index=1 else index+=1 end 
                tween.Completed:Wait() -- no need while wait to determine the length of tween animation
                
			 end
           end)
		end
	end
end

if i was you i wouldn’t use tweenservice and instead use math.sin and math.cos with tick() to synchronize all the parts

game:GetService("RunService").Heartbeat:Connect(function()
       script.Parent.SelectionBox.Color3 = Color3.new(math.sin(tick()*4),0,math.cos(tick()*4));
end);

result:

3 Likes

how do you know a color3 value like this

End up into blue or red? very specific math there


Parts outta sync

tried your code like this:

local TweenService = game:GetService([==[TweenService]==])
local animation = TweenInfo.new(1,Enum.EasingStyle.Linear)
local colorlist = {
	Color3.new(1,0,0),--Red
	Color3.new(0,0,1)--Blue
}
local index = 1
local function ToggleSelectionBox(Vehicle)
	for i, v in pairs(Vehicle.BodyKit:GetDescendants()) do
		if v:IsA('BasePart') then
			local SelectionBox = Instance.new('SelectionBox')
			SelectionBox.Parent = v
			SelectionBox.Adornee = v
			spawn(function()
				while wait(15) do
					game:GetService("RunService").Heartbeat:Connect(function()
						script.Parent.SelectionBox.Color3 = Color3.new(math.sin(tick()*4),0,math.cos(tick()*4))
					end)
				end
			end)
		end
	end
end

1 Like

you used the wrong selectionbox instance

also:

please do not use multiple heartbeat events for all the selectionboxes, make 1 event that controls them all

dont use spawn, use coroutines instead

i wouldnt recommend using tweenservice for looped animations like this

why are you putting it on a while wait(15) loop??? the heartbeat is already looping the animation

image
woah

1 Like