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

Why will this function not run on chat?

Asked by
snow29 0
9 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.
--[[
    Made by, Snow29
--]]

 brick = game.Players.LocalPlayer.Character.Torso  --define
 orbittingbrick = game.Workspace.Tablet --define
 distancefrombrick = 5 --change however you want

function Orbit()
while true do
 for i = 1,360 do
  wait()
   orbittingbrick.CFrame = brick.CFrame * CFrame.Angles(0,math.rad(i),0) * CFrame.new(0,0,-distancefrombrick)
        end
    end
end

game.Players.PlayerAdded:connect(function(player)
    player.Chatted:connect(function(msg)
        if(msg == "Orbit") then
           player.Chatted:connect(Orbit)
        end
    end)
end)

Please PM me on roblox or answer here ASAP

0
What are you trying to do? What isn't working? Where is the problem? Any output? Perci1 4988 — 9y
0
I want it to orbit a part on the chat "Orbit" , Before game.Players.PlayerAdded:connect(function(player) 19 player.Chatted:connect(function(msg) 20 if(msg == "Orbit") then 21 player.Chatted:connect(Orbit) 22 end 23 end) 24 end) already works snow29 0 — 9y
0
I don't understand. What doesn't work and where is it breaking? Perci1 4988 — 9y

2 answers

Log in to vote
0
Answered by 9 years ago

Your mistake was simple. you put ()'s on line 20 when you dont need them.

--[[
    Made by, Snow29
--]]

 brick = game.Players.LocalPlayer.Character.Torso  --define
 orbittingbrick = game.Workspace.Tablet --define
 distancefrombrick = 5 --change however you want

function Orbit()
while true do
 for i = 1,360 do
  wait()
   orbittingbrick.CFrame = brick.CFrame * CFrame.Angles(0,math.rad(i),0) * CFrame.new(0,0,-distancefrombrick)
        end
    end
end

game.Players.PlayerAdded:connect(function(player)
    player.Chatted:connect(function(msg)
        if(msg == "Orbit") then
           player.Chatted:connect(Orbit)
        end
    end)
end)

0
Thanks! snow29 0 — 9y
0
>.< Won't work In-Game for some reason,( Also this is a local script) Output:17:00:10.550 - Auto-Saving... snow29 0 — 9y
Ad
Log in to vote
0
Answered by 9 years ago

Test the script on something other that local scipt, like just regular script, or screen gui, etc.

Answer this question