Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Workspace is not a valid member of datamodel?

So, I'm fiddling around with making scripts from scratch. I've made this one script, where if you touch the part, an explosion instance is made in the part. Here's the code:

local part = game.Worspace.Boom
local db = false


function Boom(hit)
	local human = hit.Parent:FindFirstChild("Humanoid")
	local explosion = Instance.new("Explosion", game.Workspace)
	if not db then
	    if human then
		db = true
		wait(2)
		explosion.Position = part.Position
		wait(2)
		
		db = false
		
		end
	end
end


part.Touched:connect(Boom)

I'm not sure why it doesn't work. Output says "Touched is not a valid member of Workspace" and " Workspace is not a valid member of datamodel". Any suggestions?

1 answer

✓ Accepted answer

First line you errored, game.Worspace, try game.Workspace game (DataModel) does not have a child named Worspace, hence the error.

2 comments

0

Oh my gosh. I'm so stupid. My apologies. I should have noticed that. Thanks!

0

@Peeshavee It's okay, I make errors like that all the time XD

This discussion is preserved as it was. New answers, comments, and votes are closed.