I want to achieve getting these scripts and activating them while detecting if the player has something in leaderstats.
i try to run this script and it does not work buut shows no errors in output
- 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!
while true do
local character = script.Parent
local player = game.Players:GetPlayerFromCharacter(character)
local replicated = game:GetService("ReplicatedStorage")
local powerfolder = replicated.Powers
local elementsfolder = powerfolder.Elements
local bluelaserfolder = powerfolder.BlueLaserDude
local lightningfolder = powerfolder.Lightning
wait(0.8)
if player.leaderstats.Power.Value == "Elements" then
local fireballclone = elementsfolder.DetectFireball:Clone()
local earthmaggicclone = elementsfolder.DetectEarthMagic:Clone()
local icemagicclone = elementsfolder.InputDetector:Clone()
fireballclone.Parent = character
fireballclone.Enabled = true
earthmaggicclone.Parent = character
earthmaggicclone.Enabled = true
icemagicclone.Parent = character
icemagicclone.Enabled = true
elseif player.leaderstats.Power.Value == "Lightning" then
local chainclone = lightningfolder.ChainLightningClient:Clone()
local normalclone = lightningfolder.InputDetectorL:Clone()
local beamclone = lightningfolder.LightAttackClient:Clone()
beamclone.Parent = character
beamclone.Enabled = true
normalclone.Parent = character
normalclone.Enabled = true
chainclone.Parent = character
chainclone.Enabled = true
else
if character.DetectFireball then
character.DetectFireball:Destroy()
end
if character.DetectEarthMagic then
character.DetectEarthMagic:Destroy()
end
if character.InputDetector then
character.InputDetector:Destroy()
end
if character.ChainLightningClient then
character.ChainLightningClient:Destroy()
end
if character.InputDetectorL then
character.InputDetectorL:Destroy()
end
if character.LightAttackClient then
character.LightAttackClient:Destroy()
end
end
end
this script doesnt work^^
script.Parent.Activated:Connect(function()
local char = script.Parent.Parent
local hum = char:WaitForChild("Humanoid")
local animation = hum:LoadAnimation(script.Use)
local player = game.Players:GetPlayerFromCharacter(char)
if char ~= nil then
animation:Play()
wait(1)
script.Parent:Destroy()
player.leaderstats.Power.Value = "Lightning"
end
end)
this script works^^
i have not seen any solutions to my problem on the dev foruum, this is my first ever post so if i dont smth wrongg im sorry, im not that good at scripting