How to make a player get 10 damage every 1 secont if he is inside of a part

I would use zone module for something like this

--using zone functions/methods/events (in this case an event) obtain Zone's modulescript in replicated storage(see installation walkthrough)
local Zone = require(game:GetService("ReplicatedStorage").Zone)
--initialize a zonegroup, i.e. checkpoints, zones must be something a player
--touches or passes through.

local groupzone1= game.Workspace.groupzone1--Location of Block in which you want the player to see if hes inside

local zone1= Zone.new(groupzone1)

--categorizes the zones on map as a actual zone within ZonePlus module

--Checks on player entering, who that player was
zone1.playerEntered:Connect(function(player)--obtains player
--set a bool to true and loop every second or etc damage, keep checking if bool is true if not, break loop
end)

zone1.playerExited:Connect(function(player)--obtains player
--make a bool to identify that the player left in entered event and break loop
end)

Please note, the bool would have to be identifiable for the player.Name in a sort of dictionary/table so you need to understand tables for this, particularly table.insert and table.remove setting values in table..

1 Like