#why does the troll slap work but not gravity coil i can show script for both
1 messages · Page 1 of 1 (latest)
ya
Send scripts for both
troll slap script which works is
`local Players = game:GetService("Players")
local MarketplaceService = game:GetService("MarketplaceService")
local ServerStorage = game:GetService("ServerStorage")
local TROLL_SLAP_PASS_ID = 1675663309
local TrollSlapTool = ServerStorage:WaitForChild("TrollSlap")
local function giveTrollSlap(player)
if player:FindFirstChild("Backpack") and not player.Backpack:FindFirstChild("TrollSlap") then
local clone = TrollSlapTool:Clone()
clone.Parent = player.Backpack
end
end
-- When player joins
Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function()
task.wait(1)
local success, ownsPass = pcall(function()
return MarketplaceService:UserOwnsGamePassAsync(player.UserId, TROLL_SLAP_PASS_ID)
end)
if success and ownsPass then
giveTrollSlap(player)
end
end)
end)
MarketplaceService.PromptGamePassPurchaseFinished:Connect(function(player, passId, wasPurchased)
if wasPurchased and passId == TROLL_SLAP_PASS_ID then
giveTrollSlap(player)
end
end)
`
and this one doesnt gravity coil script
`local Players = game:GetService("Players")
local ServerStorage = game:GetService("ServerStorage")
local ITEM_NAME = "GravityCoil"
Players.PlayerAdded:Connect(function(player)
local coil = ServerStorage:FindFirstChild(ITEM_NAME)
if coil then
local clone = coil:Clone()
clone.Parent = player.Backpack
print("Gravity Coil given to " .. player.Name)
else
warn("Could not find GravityCoil in ServerStorage!")
end
end)`
Well the script are totally different formats lol
let me fix ur coil script for you
tytyty
ya np
Here are optimized versions of both scripts
Troll Slap:
local Players = game:GetService("Players")
local MarketplaceService = game:GetService("MarketplaceService")
local ServerStorage = game:GetService("ServerStorage")
local GamepassID = 1675663309
local TrollSlap = ServerStorage:WaitForChild("TrollSlap")
local function giveTrollSlap(player)
if player:FindFirstChild("Backpack") and not player.Backpack:FindFirstChild("TrollSlap") then
local clone = TrollSlap:Clone()
clone.Parent = player.Backpack
end
end
Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function()
task.wait(1)
local success, ownsPass = pcall(function()
return MarketplaceService:UserOwnsGamePassAsync(player.UserId, GamepassID)
end)
if success and ownsPass then
giveTrollSlap(player)
end
end)
end)
MarketplaceService.PromptGamePassPurchaseFinished:Connect(function(player, passId, wasPurchased)
if wasPurchased and passId == GamepassID then
giveTrollSlap(player)
end
end)
Gravity Coil:
local Players = game:GetService("Players")
local MarketplaceService = game:GetService("MarketplaceService")
local ServerStorage = game:GetService("ServerStorage")
local GamepassID = 1675915374
local GravityCoil = ServerStorage:WaitForChild("GravityCoil")
local function giveGravityCoil(player)
if player:FindFirstChild("Backpack") and not player.Backpack:FindFirstChild("GravityCoil") then
local clone = GravityCoil:Clone()
clone.Parent = player.Backpack
end
end
Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function()
task.wait(1)
local success, ownsPass = pcall(function()
return MarketplaceService:UserOwnsGamePassAsync(player.UserId, GamepassID)
end)
if success and ownsPass then
giveGravityCoil(player)
end
end)
end)
MarketplaceService.PromptGamePassPurchaseFinished:Connect(function(player, passId, wasPurchased)
if wasPurchased and passId == GamepassID then
giveGravityCoil(player)
end
end)
@opal phoenix
thanks so much let me test it out rq
let me know if there's any errors
Haha, appriciate it mate, lol
i just have one more thing if you dont mind sorryyy 😭
this one might be bit harder but so bascially with my troll slap, if i touch like any part it affects them
idrc about the animation not working ill do it some other day
You only want it to do it when you click I assume?
yeah
this is the script
`--02fzx
local FlingAmount = 40 --sky
local sound = true --well i mean its defau; so..
local sit = false --If it makes the player sit.
local e = false --Do not change.
local explode = true --This one just kills you
function hit(Touch)
local blender = Touch.Parent:FindFirstChild("Head")
if not (blender == nil) then
if e == false then
e = true
local bv = Instance.new("BodyVelocity")
bv.P = 1250
bv.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
bv.Velocity = blender.CFrame.lookVector*-FlingAmount
bv.Parent = blender
if sit == true then
Touch.Parent:FindFirstChild("Humanoid").Sit = true
end
if sound == true then
local s = script.Parent.slaps:Clone()
local random = math.random(8,12)/10
s.Parent = blender
s.PlaybackSpeed = 1
s:Play()
end
wait(.05)
bv:Destroy()
wait(.2)
e = false
wait(1)
if explode == true then
end
end
end
end
script.Parent.Touched:connect(hit)`
Oh jeez
i got the troll slap from a model and pasted it into serverstorage and then script the gamepass and yeah
its fine if you dont wanna do it lol ik this one takes a while xD
your an angel i swear tysm
That script is designed terribly though lol
Send me the explorer pic of your slap tool
no worries
@opal phoenix What should the cooldown for the weapon be?
3 seconds please
Testing nowww
how did it work out?
noo wayy
alright
Step 1:
Create a brand new script in ServerScriptService and name it "SlapServer"
i needa give you at least 200 robux for this bro taking time out of your day just to do this for a random person your so nice bro ty 😭
nahhh no need
alr
send pic when you do so i can make sure it's good lol
alright this good?
Cool cool
next paste this in it
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Event = ReplicatedStorage:WaitForChild("ToolUsedEvent")
local FlingForce = 150
local UpwardForce = 50
local PlayerCooldown = 1
local SwingRange = 6
local playerCooldowns = {}
local function getHorizontalDirection(from, to)
local dir = (to - from)
return Vector3.new(dir.X, 0, dir.Z).Unit
end
Event.OnServerEvent:Connect(function(player)
local now = tick()
if playerCooldowns[player] and now - playerCooldowns[player] < PlayerCooldown then
return
end
playerCooldowns[player] = now
local character = player.Character
local tool = character:FindFirstChildOfClass("Tool")
local handle = tool:FindFirstChild("Handle")
local root = character:FindFirstChild("HumanoidRootPart")
for _, part in ipairs(workspace:GetDescendants()) do
local hitChar = part.Parent
if hitChar and hitChar ~= character then
local humanoid = hitChar:FindFirstChild("Humanoid")
local HRP = hitChar:FindFirstChild("HumanoidRootPart")
if humanoid and HRP then
local distance = (HRP.Position - handle.Position).Magnitude
if distance <= SwingRange then
local direction = getHorizontalDirection(root.Position, HRP.Position)
local impulse = Vector3.new(
direction.X * FlingForce,
UpwardForce,
direction.Z * FlingForce
)
HRP:ApplyImpulse(impulse)
end
end
end
end
end)
alrighttt done
Create a 'RemoveEvent' inside ReplicatedStorage and name it "ToolUsedEvent" (The name has to be exact)
okay this good?
no should i do it now
Yeah
alriught done
Okay next create a tool in ServerStorage and name it "SlapTool"
Again, I think the name has to be exact
done
Okay next put a localscript inside that tool and name it whatever you want
it has to be a LOCALscript, not a serverscript
alright just gonna keep as is
Works for me
okay paste this in there
local Tool = script.Parent
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local AnimationID = "rbxassetid://1234567890" -- Put your AnimationID here
local Sound = Tool:FindFirstChild("SwingSound")
local Event = game.ReplicatedStorage:WaitForChild("ToolUsedEvent")
local Animation = Instance.new("Animation")
Animation.AnimationId = AnimationID
Animation.Parent = Tool
local AnimationTrack
local Cooldown = 3
local OnCooldown = false
local function SetupAnimator()
Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")
AnimationTrack = Humanoid:LoadAnimation(Animation)
end
Tool.Equipped:Connect(SetupAnimator)
Tool.Activated:Connect(function()
if OnCooldown then return end
if not AnimationTrack then
SetupAnimator()
end
OnCooldown = true
AnimationTrack:Play()
Sound:Play()
Event:FireServer()
task.delay(Cooldown, function()
OnCooldown = false
end)
end)
done
Do you have an Animation ID saved that you want to use, or do you just want me to give you one temporarily?
however i dont have an animation id i dont rlly need an animationn
i'll just give you one
yes please 😂
alrighty done
send pic of that line
alright created
** You are now Level 12! **
Lastly you need a handle, if you have one just put that inside of the tool
I can't really give you one so whatever slap tool model you have just throw it in there
alright i have one
it has a sound in it should i remove
send a pic of it rq
Yes remove CoilSound
done
Okay test it out and send me any errors in output bar
you might get one that says you don't have permission to use ID but we can fix
oh crap i forgot since i deleted my tool theres no point in the script that gives me the slap
hold on let me rename to SlapServer
cuause look
`local Players = game:GetService("Players")
local MarketplaceService = game:GetService("MarketplaceService")
local ServerStorage = game:GetService("ServerStorage")
local TROLL_SLAP_PASS_ID = 1675663309
local TrollSlapTool = ServerStorage:WaitForChild("TrollSlap")
local function giveTrollSlap(player)
if player:FindFirstChild("Backpack") and not player.Backpack:FindFirstChild("TrollSlap") then
local clone = TrollSlapTool:Clone()
clone.Parent = player.Backpack
end
end
-- When player joins
Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function()
task.wait(1)
local success, ownsPass = pcall(function()
return MarketplaceService:UserOwnsGamePassAsync(player.UserId, TROLL_SLAP_PASS_ID)
end)
if success and ownsPass then
giveTrollSlap(player)
end
end)
end)
MarketplaceService.PromptGamePassPurchaseFinished:Connect(function(player, passId, wasPurchased)
if wasPurchased and passId == TROLL_SLAP_PASS_ID then
giveTrollSlap(player)
end
end)
`
but trollslap doesnt exist anymore I deleted it
in your gamepass script it is referenced as "TrollSlap"
so that's what it needs to be
@opal phoenix ya still there lol
yep yep
your right
but it does say 22:15:52.788 Players.Aimplified.Backpack.TrollSlap.LocalScript:34: attempt to index nil with 'Play' - Client - LocalScript:34 what is that due to
that's because the ID has no access
once you share access both errors will be fixed
crap
how long will this take 😭
alr im in toolbox
sword animation
search that up
put this one in your game, should be the first one that pops up
were just using sword for now
we can use a customone later
this is just a placeholder
found it
okay wait
don't use that one i sent wrong one
oh alr
got it
kk
here
Click animation then click on the rig you just imported from toolbox
got it
send pic of screen again
alrigt then whch option
sword slice 3
perfect
click 3 dots again
then press publish to roblox
Make sure creator is set to yourself
then press save
DONT CLOSE THE NEXT TAB THAT COMES UP AFTER YOU PRESS SAVE
oops sorry for caps accident
press that little button to copy the working ID
lot of steps lol
alright
all of that is done?
im getting very tired might considering finishing tmrw 😭
alr bey
kk
done
testtttt
yess
wait a sec where do i open output
like how do i open output mb
View in the top right
wait no mbmb
press wndow
window
then output
did the scripts workkkkkk
@opal phoenix i gtg bed soon so let me know quick if it's working or not lol
heck yeahhhhh
i gtg sleep aswell tysmmm