Hello.
So I’m moving on into creating my own game! everything has been going smooth so far but I’ve ran into a major problem that isn’t really making sense to me.
When first hopping onto a pad then proceeding to hop off the values don’t reset themselves and I’m confused why that’s happening. Cause if I hop onto the other pad and hop off everything works perfectly.
The problem occurs when I trying on both pads and I’m completely clueless on what’s going on or how to fix it.
– Pictures
Pad:
When First Hopping On & Off:
Same thing but with the other pad:
– Code
-- Services --
local Players = game:GetService('Players')
----
-- On Joined/Added --
Players.PlayerAdded:Connect(function(Player)
Player.CharacterAppearanceLoaded:Connect(function(Character)
-- Variables --
local HumanoidRootPart = Character:FindFirstChild('HumanoidRootPart')
local Humanoid = Character:FindFirstChild('Humanoid')
-- For Statement --
for _,Pad in ipairs(workspace.Map.Platforms:GetDescendants()) do
-- On Walk/Enter Pad Check --
if string.sub(Pad.Name,1,4) == 'Team' and Pad.Parent.Name == 'Queue' and Pad:IsA('Model') then
Pad.Accent.Touched:Connect(function(Hit)
-- Check --
if not Hit.Parent:FindFirstChild('Humanoid') or not Hit.Parent:FindFirstChild('HumanoidRootPart') or not Pad.Parent.Parent:GetAttribute(Pad.Name .. 'Queueable',false) then return end
-- Set/Change --
Hit.Parent.Humanoid.WalkSpeed = 0
Hit.Parent.HumanoidRootPart.CFrame = CFrame.new(Pad.Accent.Position.X,Hit.Parent.HumanoidRootPart.Position.Y,Pad.Accent.Position.Z)
Hit.Parent.HumanoidRootPart.Orientation = Vector3.new(0,-90,0)
Pad.Parent.Parent:SetAttribute(Pad.Name,Hit.Parent.Name)
Pad.Parent.Parent:SetAttribute(Pad.Name .. 'Queueable',false)
end)
-- On Jump/Leave Pad Check --
Humanoid:GetPropertyChangedSignal('Jump'):Connect(function()
-- Check --
if Humanoid.WalkSpeed == 0 then
Humanoid.WalkSpeed = 16
Pad.Parent.Parent:SetAttribute(Pad.Name,'')
wait(2)
Pad.Parent.Parent:SetAttribute(Pad.Name .. 'Queueable',true)
end
end)
end
end
end)
end)
----