I’m working on a character selector for my Fist of the North Star fighting game, and I’m having trouble making it so the dash script for each character is deleted when you switch from each character. The combat scripts work just fine, they get traded and deleted without issue; but the script for the dash stays regardless of what character you pick.
I’ve tried putting the InputManager scripts (the scripts with the dash) inside the combat scripts, but that just breaks the dash. I am stumped here, and i cant progress with development if i let this bug persist.
If its important, this is the first time ive ever made a game. I have followed a few tutorials online and i cant seem to crack why its working for the combat but not the dash.
Character select script below
local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid")
local container = script.Parent
local Icon = require(container.Icon)
local kenshirop = false
local testp = false
local reip = false
Icon.new()
:setName("Characters")
:setLabel("Characters")
:setImage(108016607962951)
:bindEvent("selected", function()
end)
:setDropdown({
Icon.new()
:setName("Apoclyptic Savior")
:setLabel("Apoclyptic Savior")
:setImage(75135816279518)
:bindEvent("selected", function()
if kenshirop == false then
kenshirop = true
reip = false
game.ReplicatedStorage.MainEvent:FireServer("Kill")
if plr.PlayerScripts:FindFirstChild("ReiCombatClient") then
plr.PlayerScripts.ReiCombatClient:Destroy()
end
if plr.PlayerScripts:FindFirstChild("ReiInputManager") then
plr.PlayerScripts.ReiInputManager:Destroy()
end
local ClientScript = game.ReplicatedStorage:WaitForChild("Scripts"):WaitForChild("KenshiroCombatClient"):Clone()
ClientScript.Parent = plr.PlayerScripts
local ClientScript2 = game.ReplicatedStorage:WaitForChild("Scripts"):WaitForChild("KenshiroInuptManager"):Clone()
ClientScript2.Parent = plr.PlayerScripts
end
end)
,
Icon.new()
:setName("Rei")
:setLabel("White Water Bird")
:setImage(75135816279518)
:bindEvent("selected", function()
if reip == false then
reip = true
kenshirop = false
game.ReplicatedStorage.MainEvent:FireServer("Kill")
if plr.PlayerScripts:FindFirstChild("KenshiroCombatClient") then
plr.PlayerScripts.KenshiroCombatClient:Destroy()
end
if plr.PlayerScripts:FindFirstChild("KenshiroInputManager") then
plr.PlayerScripts.KenshiroInputManager:Destroy()
end
local ClientScript = game.ReplicatedStorage:WaitForChild("Scripts"):WaitForChild("ReiCombatClient"):Clone()
ClientScript.Parent = plr.PlayerScripts
local ClientScript2 = game.ReplicatedStorage:WaitForChild("Scripts"):WaitForChild("ReiInuptManager"):Clone()
ClientScript2.Parent = plr.PlayerScripts
end
end)
})
Video of this bug, incase it helps in any way. Thank you in advance!