I want to make a tycoon game but the script is not working. every time I try to test the game it just freezes and I don't know why.
while true do script.Parent.Mouseclick:Connect(function() chair = game.Workspace.Chair:Clone() chair.Position = game.Players.LocalPayer.Mouse() end
what is wrong help me.
Several problems with this.
1st problem. You are listening to an event inside the loop. 2nd problem. you never end the event. 3rd problem. you're cloning the chair each time. 4th problem. you're not setting the clone's parent. 5th problem. player.Mouse() is not a valid way to obtain mouse. 6th problem. Mouse is not a Vector3 Value.
Get rid of the loop, Connect to the event properly, actually close it, create the clone outside of the event, set its parent, set its position inside the event, you can obtain mouse by using player:GetMouse(), to get its position you do mouse.Hit.Position
You need to add a wait() at the end of the while loop because while loops are executed at the fastest speed and that's what made your game freeze. Also, you have spelled MouseClick wrong. It's supposed to have a capital M and C. Here's a better version of what you tried to do:
local mouse = game.Players.LocalPlayer:GetMouse() while true do script.Parent.MouseClick:Connect(function() local chair = game.Workspace.Chair:Clone() chair.Position = mouse.Hit.p end) wait() end