Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How could I get this to work? (Roblox Lua)

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. 🙂

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>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?

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading