Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I spawn a model when the player chats?

Asked by 9 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

So this script is suppose to spawn In one of my models when the player says something, but It's not working and I get no errors. It's in a local script.

01local player = game.Players.LocalPlayer
02local hum = player.Character:WaitForChild("Humanoid")
03local pentagram = script.Parent
04local spell = "Hello"
05 
06 
07     player.Chatted:connect(function(message)
08            if string.lower(message) == string.lower(spell) then
09            wait(5)
10        local crystal = game:GetService("InsertService"):LoadAsset(278749111)
11            crystal.Parent = game.Workspace
12            crystal.Position = pentagram.Position --[[+ Vector3.new(0,5,0)]]--
13            crystal.Transparency = 1
14            wait(0.1)
15            crystal.Transparency = 0.9
View all 35 lines...

1 answer

Log in to vote
0
Answered by
Ryzox 220 Moderation Voter
9 years ago

Position is not a valid property of model and you will also want to wait until the character is loaded then declare it. e.g -

1local player = game.Players.LocalPlayer
2repeat wait() until player.Character -- repeats wait() until it can find player.Character
3local char = player.Character

You are also not using the player's character or humanoid at all in this script so there really is no point in defining it.

To move the model you will have to do

1Model:MoveTo(Vector3.new(0,6,0))

Something like that.

0
I am using character I just deleted the code for testing purposes. 64batsalex 45 — 9y
0
Still doesn't work. 64batsalex 45 — 9y
Ad

Answer this question