So i am making a one piece game with Devil-fruits. I am currently working on Suke no mi, witch gives you the ability to become invisible. for you who don’t know what an devil fruit is it´s basically a fruit that gives abilities/magic.
The Logic:
I transform the bodyParts and decals transparency to 0 after the invisible time or the player got dameged but the HumanoidRootPart is getting 0 as transparency. I made a if statement in line () and () that it should ignore HumanoidRootPart. Because i dont want the HumanoidRootPart to be visible.
This is the local script, located in player scripts.
local SukeRemote = game.ReplicatedStorage.FireClientEvent
local InvisibleTime = 20
SukeRemote.OnClientEvent:Connect(function(plr,AttackE)
if AttackE == "AttackE" then
print("RenderSuke AttackE")
local c = plr.Character
local Humanoid = c:FindFirstChild("Humanoid")
for i, v in ipairs(c:GetDescendants()) do
if v:IsA("BasePart") or v:IsA("Decal") then
local Info = TweenInfo.new(2)
local Tween = game:GetService("TweenService"):Create(v,Info,{Transparency=1})
Tween:Play()
end
end
local OldHealth = Humanoid.Health
Humanoid:GetPropertyChangedSignal("Health"):Connect(function()
OldHealth = Humanoid.Health
end)
Humanoid:GetPropertyChangedSignal("Health"):Connect(function()
if Humanoid.Health < OldHealth then
for i, v in ipairs(c:GetDescendants()) do
local PrevV = v.Name
if v:IsA("BasePart") or v:IsA("Decal") and v.Name ~= "HumanoidRootPart" and v.Name ~= PrevV then -- Heres the problem. i transform the body and decals transparency to 0 -----again, but the humanoid root part still gets it´s transparency to 0.
local Info = TweenInfo.new(2)
local Tween = game:GetService("TweenService"):Create(v,Info,{Transparency=0})
Tween:Play()
end
end
end
end)
wait(InvisibleTime)
for i, v in ipairs(c:GetDescendants()) do
local PrevV = v.Name
if v:IsA("BasePart") or v:IsA("Decal") and v.Name ~= "HumanoidRootPart" and v.Name ~= PrevV then
local Info = TweenInfo.new(2)
local Tween = game:GetService("TweenService"):Create(v,Info,{Transparency=0})
Tween:Play()
end
end
end
end)
-
What is the issue? Include screenshots / videos if possible!
-
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
-- This is an example Lua code block
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.