stand_value = 0
name = script.Parent.Parent
if stand_value == 0 then
end
if stand_value == 1 then
givetusk()
print("12")
end
local tusk1 = game.ReplicatedStorage.stands.Tusk1
function givetusk(player)
print("!")
if player then
local character = player.character
if character then
local humanroot = character.HumanoidRootPart
local newtusk = tusk1:Clone()
newtusk.Parent = character
local bodyPos = Instance.new("BodyPosition", newtusk)
bodyPos.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
local bodyGyro = Instance.new("BodyGyro", newtusk)
bodyGyro.MaxTorque = Vector3.new(math.huge,math.huge,math)
while wait()do
bodyPos.Position = humanroot.Position + Vector3.new(3,0,0)
bodyGyro.CFrame = humanroot.CFrame
end
end
end
end
return module```
#problem with spawning stand
11 messages · Page 1 of 1 (latest)
the script is placed in replecated storage
and its not showing errors
just the stand isnt spawning
All types of scripts cannot run by themselves inside of ReplicatedStorage
Since you're using a modulescript from the looks of it, you should call the givetusk function from outside, preferably a server-side script. And ensure the function is a part of the returned module so it can actually be called.
You also need to run the script when the intended player actually starts existing.
Your module script currently only checks for a player as soon as the script is loaded (on server startup) then never again.
Another thing: I recommend keeping modules that contain functions that are meant to be on the server-side only, inside of ServerStorage. So that way, the client (exploiters) cannot access modules they aren't meant to use on their end.
The module script:
local Module = {}
function Module.givetusk(Player)
print("Works.")
end
-- Alternatively:
Module.givetusk = function(Player)
print("Still works.")
end
-- Alternatively 2:
Module = {
givetusk = function(Player)
print("STILL works!")
end
}
return Module
The server script:
local ModuleScript = require(game.ReplicatedStorage:WaitForChild("ModuleScript", 300))
game.Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
local Humanoid = Character:WaitForChild("Humanoid", 30)
-- Recommended to wait for at least the Humanoid to ensure Character is FULLY loaded.
ModuleScript.givetusk(Character)
end)
end)
@twin crypt ^
Hope this helps!
If you have any questions, be sure to ask!
the server script where should i put it
You can put it in Workspace, ServerScriptService, any of the StarterPlayer stuff, or anywhere in StarterGui.
i just realised i dont want it to be player added