Advertisements
So, recently I have become interested in creating a worthy and fun Roblox game. I decided to add a cool feature, where if you go into your assigned room, it will kill your player. Sadly, the code I have currently doesn’t seem to work.
Example:
local Display = script.parent.Frame.TextLabel.Numberdisplay
number.Value = math.random(101, 113)
Door = "Door"
local numby = Door.. number.Value
Display.Text = number.Value
local player = game:GetService("Players").LocalPlayer
local Shop = workspace.numby
Shop.Touched:Connect(function(hit)
if hit.Parent == player.Character then
player.Character.Humanoid:TakeDamage(1000)
end
end)
Any form of help would be great. 🙂
>Solution :
I don’t know where you got player from but if that’s the issue try this:
Shop.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health - 9999
end
end)
could you also explain what numby is?