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

Working in play mode, but not ingame? [ SOLVED]

It works in play mode in studio, but it doesn't work ingame, please help.

The RemoteEvent is inside ReplicatedStorage.

Server Script > ServerScriptService


local RepStorage = game:GetService("ReplicatedStorage")
local Ice = RepStorage.RemoteEvents.IceMove


if Ice ~= nil then

	wait(2)
	Ice:FireAllClients()

end

Local Script > StarterPack



local player = game.Players.LocalPlayer

repeat wait() until player.Character

local character = player.Character
local humroot = character.HumanoidRootPart

local RepStorage = game:GetService("ReplicatedStorage")
local Ice = RepStorage.RemoteEvents.IceMove



local deb = true

local Folder = Instance.new("Folder")
Folder.Name = "Ability Holder"
Folder.Parent = character

Ice.OnClientEvent:connect(function()

game:GetService("UserInputService").InputBegan:connect(function(input, gameProcessedEvent)
		
		if input.KeyCode == Enum.KeyCode.R then
			if deb then
				
				deb = false
				print("Trying to spawn it")
				local x = Instance.new("Part")
				x.Parent = Folder
				x.Name = "Ice Punch"
				x.Size = Vector3.new(3,0.6,3)
				x.Position = Vector3.new(humroot.Position.X, x.Position.Y, humroot.Position.Z) + humroot.CFrame.lookVector * 20
				x.Rotation = humroot.Rotation
				
				
				
				
				
				
				wait()
			end
			deb = true
		end
	end)	
end)

2 comments

0

Give me the specific locations for where the Server Script and the Local Scripts are located.

0

Check the script again for the locations.

1 answer

To my knowledge, ServerScriptService is something you should NOT use when Filtering. (I could be wrong.) Try putting the same script in workspace and seeing where you get.

Secondly, I don't believe repeat wait() until player.Character is a good method to find characters. On a ROBLOX game server, characters may load much more slowly. And to my knowledge using parenting like that when an object does not exist, it will produce an error. Try something more like workspace:WaitForChild(player.Name).

If neither of these are the problem, use F9 in-game and check the server/console log. There should be an error somewhere telling you what's going wrong.

Hope this helps!

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