I'm trying to create a game with Splatoon-like mechanics, and the swimming in ink works fine but when it comes to wall climbing it isn't working. What I originally tried was using velocity but it flopped so instead I opted to use invisible trusses that become collide-able if the its color is the same as the players. However the character usually goes to the edge of the wall rather than going up.
Squid Movement:
local player = game.Players:GetPlayerFromCharacter(script.Parent.Parent.Parent)
local character = script.Parent.Parent.Parent
local speed = 5
local weld = script.Parent.Weld
local squid = script.Parent.Parent
script.Parent.Touched:connect(function(hit)
if hit.Name == "InkablePart" or "InkableWall" then
if hit.Name == "InkablePart" then
if hit.Color == script.Parent.Color then
speed = 30
else
speed = 5
end
end
if hit.Name == "InkableWall" or hit.Parent.Name == "InkableWall" then
if hit.Name == "InkableWall" then
if hit.Color == script.Parent.Color then
speed = 15
for i,v in pairs(hit:GetChildren()) do
v.CanCollide = true
end
else
speed = 5
for i,v in pairs(hit:GetChildren()) do
v.CanCollide = false
end
end
else
if hit.Parent.Color == script.Parent.Color then
speed = 15
for i,v in pairs(hit.Parent:GetChildren()) do
v.CanCollide = true
end
else
speed = 5
for i,v in pairs(hit.Parent:GetChildren()) do
v.CanCollide = false
end
end
end
end
else
for i,v in pairs(workspace:GetChildren()) do
if v.Name == "InkableWall" then
for i,v in pairs(v:GetChildren()) do
v.CanCollide = false
end
end
end
speed = 5
end
end)
while true do
if speed == 30 then
weld.C0 = CFrame.new(0,3,0) * CFrame.Angles(0,math.rad(180),0)
elseif speed == 5 then
weld.C0 = CFrame.new(0,2.25,0) * CFrame.Angles(0,math.rad(180),0)
elseif speed == 15 then
for i,v in pairs(squid:GetChildren()) do
if v:IsA('Part') or v:IsA('UnionOperation') then
v.Transparency = 1
end
end
repeat wait() until speed ~= 15
for i,v in pairs(squid:GetChildren()) do
if v:IsA('Part') or v:IsA('UnionOperation') then
v.Transparency = 0
end
end
end
character.Humanoid.WalkSpeed = speed
wait()
end
To make the squid the characters body parts and hats and stuff are made invisible and then the squid is welded to the humanoidrootpart with an offset so it appears like it's swimming.
