#trying to make it so every 100 strength you get +5 damage, you start out with 5 damage. (desc

238 messages · Page 1 of 1 (latest)

orchid elm
#

it doesnt work though

                game.Players.PlayerAdded:Connect(function(player)
                    local Sila = player.leaderstats:FindFirstChild("Siła").Value

                    local STATDMG = 5
                    STATDMG = math.floor(Sila/100) + 5

                    touched.Parent.Humanoid:TakeDamage(STATDMG)
                end)
shrewd vessel
#

you tryna get help with out giving us any error or info

livid eagle
#

Lmao

orchid elm
#

the script seems all good

#

but still doesn't work

#

idk whats the problem

torpid summit
#

what is sila

#

strength?

orchid elm
#

yes

torpid summit
#

ok

orchid elm
#

its the leaderstats

#

i mean

#

its the stat

#

inside

#

leaderstats

torpid summit
#

you don't update sila from when they join

orchid elm
#

when i attack

#

i deal 0 damage

#

basically it counts as statdmg is nil

#

idk why

#

even tho i put it at 5

torpid summit
#

have you printed STATDMG

orchid elm
#

leemme try it

#

doesnt print

#

anything

#

@torpid summit

runic etherBOT
#

studio** You are now Level 1! **studio

orchid elm
#

?

torpid summit
#

send a ss of your output

orchid elm
#

its nothing there

#

@torpid summit

torpid summit
#

send a ss

orchid elm
#

bro

#

its nothing there

#

do yo want me to send you

#

a blank

#

@torpid summit

torpid summit
#

print sila

#

also is the script enabled

#

furthermore, where is the script located

orchid elm
orchid elm
#

sila doesn't print

torpid summit
#

where is the fist tool located

orchid elm
#

WDYM

#

its located in starterpack

orchid elm
#

think

#

when u have to use it

#

to punch

#

then yes

#

@torpid summit

#

help

shrewd vessel
orchid elm
#

lemme get it

#

also one thing dont steal it since my friend will be mad

#

i promised him too help him fix it and learn scripting

#

bc its his script

#

i wanted to prove him

#

@shrewd vessel

shrewd vessel
#

hey

shrewd vessel
orchid elm
#

ok

runic etherBOT
#

studio** You are now Level 2! **studio

orchid elm
#

can you please help me

#

i really want to be better scripter

shrewd vessel
#

are you sure the hit event is being called

orchid elm
#

its just

#

when i would put it

#

remove the other pats of script

#

it doesnt work though

                game.Players.PlayerAdded:Connect(function(player)
                    local Sila = player.leaderstats:FindFirstChild("Siła").Value

                    local STATDMG = 5
                    STATDMG = math.floor(Sila/100) + 5

                    touched.Parent.Humanoid:TakeDamage(STATDMG)
                end)
#

aka this

#

it doesnt work though

                    touched.Parent.Humanoid:TakeDamage(STATDMG)
#

and iinstead of statdmg

#

i would put 20

#

then it would take 20 dmg

#

but when i put statdmg and did script

#

then its not working

#

does 0 damage

#

doesnt print statdmg either sila

shrewd vessel
#

why are you using game.players.playeradded to dmg them

orchid elm
#

im making it

#

so it detects player

#

and their leaderstats

#

its not local script

#

so cant localplayer

shrewd vessel
#

i mean

#

you dont rlly need the game.players.playeradded

orchid elm
#

wait

#

i just saw something

#

because

#

my friend already detected it

#

the touched is the part

#

so i can make it

#

statdmg connected with touched?

shrewd vessel
#

that event fires when a player is added to the game

runic etherBOT
#

studio** You are now Level 11! **studio

orchid elm
#

so i can do

#

local sila = touched

#

touched.Leaderstats

#

hmm

#

let me try

shrewd vessel
#

what

#

that wont change anything

orchid elm
#

idk

#

im tryna

shrewd vessel
#

the code is rlly messy too

orchid elm
#

to detect the player

#

how do i detect player

shrewd vessel
#

.touched already detects what it hits

orchid elm
#

ik

shrewd vessel
#

just get the humanoid parent

#

char

#

then use

#

from char to plr func

#

to get the hit player

orchid elm
#

local Sila = touched.Parent.leaderstats:FindFirstChild("Siła").Value

#

will this work

#

is leaderstats inside humanoid

#

or the player

shrewd vessel
#

you should know that

orchid elm
#

i forgor

shrewd vessel
#

also i suppose

#

you where using PlayersAdded to get the player no?

orchid elm
#

yes

shrewd vessel
#

it doesnt work like that

orchid elm
#

someone told me

#

to do it like that

shrewd vessel
#

no

#

that wont work

#

cuz

#

that event fires when a player is added to the game

#

to get the player

orchid elm
#

oh

#

idk how to make this work

shrewd vessel
#

you can simply use this

#

this allows you to get the player instance from the character

orchid elm
#

local function getPlayerFromCharacter(character)
for _, player in game:GetService("Players"):GetPlayers() do
if player.Character == character then
return player
end
end
end

runic etherBOT
#

studio** You are now Level 3! **studio

orchid elm
#

@shrewd vessel now whole script is errored

shrewd vessel
#

wdym

orchid elm
#

wait lemme try

#

again

shrewd vessel
#

its a built in function in roblox tho

orchid elm
#

where do i put it

#

then

#

@shrewd vessel

#

it errors

shrewd vessel
#

show the error

orchid elm
#
                local function getPlayerFromCharacter(character)
                    for _, player in game:GetService("Players"):GetPlayers() do
                        if player.Character == character then
                            return player
                        end
                        
                        local Sila = player.leaderstats:FindFirstChild("Siła").Value

                        local STATDMG = 5
                        STATDMG = math.floor(Sila/100) + 5

                        touched.Parent.Humanoid:TakeDamage(STATDMG)
                        
                    end
                end
#

@shrewd vessel i did this

#

and doesnt show

#

any red lines

shrewd vessel
#

bro

#

...

orchid elm
#

bro

#

idk im new

#

im tryna help my friend

shrewd vessel
#

just do

#
                        local player = game:GetService("Players"):GetPLayerFromCharacter(touched.Parent)
                        local Sila = player.leaderstats:FindFirstChild("Siła").Value

                        local STATDMG = 5
                        STATDMG = math.floor(Sila/100) + 5

                        touched.Parent.Humanoid:TakeDamage(STATDMG)```
orchid elm
#

wdym your char

#

oh

#

wait

shrewd vessel
#

touched.Parent

orchid elm
#

testing rn

#

now it doesn't even work

#

before it dealt 0 damage

#

now cant even hit

#
                local player = game:GetService("Players"):GetPlayerFromCharacter(touched.Parent)
                local Sila = player.leaderstats:FindFirstChild("Siła").Value

                local STATDMG = 5
                STATDMG = math.floor(Sila/100) + 5

                touched.Parent.Humanoid:TakeDamage(STATDMG)
shrewd vessel
#

strange

#

are you sure you touching stuff

orchid elm
#

ye

#

i hit dummy

#

now it doesnt even hit

shrewd vessel
#

did you try debugging?

orchid elm
#

before it dealt 0 damage

#

and hit

#

ye

#

doesnt work

shrewd vessel
orchid elm
#

touched parent isnt player btw

shrewd vessel
#

did you try printing what it hit?

orchid elm
#

ye

#

it hit dummy

#

bc i had

#

a done print in

#

but now it didnt

shrewd vessel
orchid elm
#

print anyrthing

#

its not

shrewd vessel
#

bro

#

print what it hits

#

not the dmg done

orchid elm
#

local enmy = touched.Parent
local enmyhrp = enmy.HumanoidRootPart

            local dmgsoclone = dmgsoun1:Clone()
            dmgsoclone.Parent = enmyhrp
            dmgsoclone:Play()
            
            local enemyhum = touched.Parent.Humanoid
            enemyhum:LoadAnimation(knock1):Play()
            local higclone = highlit:Clone()
            higclone.Parent = enmy
            higclone.Enabled = true
            print('damage done')
            soun1played = true
            dam = true
orchid elm
#

torso

#

but now whole script broke

shrewd vessel
#

try this rq

#
                local EnemyPlayer = game:GetService("Players"):GetPlayerFromCharacter(touched.Parent)
                print(EnemyPlayer.Name)
                local Sila = EnemyPlayer.leaderstats:FindFirstChild("Siła").Value

                local STATDMG = 5
                STATDMG = math.floor(Sila/100) + 5

                touched.Parent.Humanoid:TakeDamage(STATDMG)
orchid elm
orchid elm
shrewd vessel
#

enemy player is nil then

#

ima go have breakfast rq tho

#

then help ya

orchid elm
#

alr

shrewd vessel
#

also dont trust .Touched for hitboxes

#

use parts bound in box

#

parts in parts

#

they are 10 times better

#

also

orchid elm
#

i can add you

shrewd vessel
#

get better code optimization

orchid elm
#

to studio

#

if you want

#

i can ask my friend to add you

shrewd vessel
#

nah

orchid elm
orchid elm
#

@shrewd vessel

shrewd vessel
#

im back

#

had to do some sh

orchid elm
shrewd vessel
#

im in call with my gf rn

#

ima help ypu when im done

orchid elm
#

k

orchid elm
#

@shrewd vessel