Reputation: 15
So, I scripted a chat code detector in Roblox; I wanted to move an object (Elevator) to a specific position. The object does not move at all.
Things I have tried:
However the strangest thing of all: At the bottom of Roblox Studio there is a bar that allows you to execute commands. When I run the exact piece of code that moves the object inside that bar, it moves. I do not know what is even happening.
local message='thestars'
function onChatted(msg,recipient,speaker)
local source=string.lower(msg)
if (msg==message) then
game.Workspace.Elevator.Position=Vector3.new(99,-57,72)
script.NOISE:Play()
game.Workspace.radio.Radio.Union.Sound:Pause()
while true do
game.Workspace.bruh.Transparency-=.025
wait()
end
end
end
function onPlayerEntered(newPlayer)
newPlayer.Chatted:connect(function(msg,recipient) onChatted(msg,recipient,newPlayer) end)
end
game.Players.PlayerAdded:connect(onPlayerEntered)
Upvotes: 1
Views: 826
Reputation: 1
I did this by making a local script so that when the player chats "thestars", it fires a remote event to the server which does the action. Try that:
Local script:
local checkMessage = function(msg,recipient,speaker)
local message='thestars'
if msg == message then
game.ReplicatedStorage:WaitForChild(urthing):FireServer()
end
end
game.Players.LocalPlayer.Chatted:Connect(checkMessage)
Server script:
local myFunction = function()
local source=string.lower(msg)
game.Workspace.Elevator.Position=Vector3.new(99,-57,72)
script.NOISE:Play()
game.Workspace.radio.Radio.Union.Sound:Pause()
while true do
game.Workspace.bruh.Transparency-=.025
wait()
end
end
game.ReplicatedStorage:WaitForChild("thingyremote").OnServerEvent:Connect(myFunction)
Upvotes: -1